<<<<<<< HEAD Manuscript 1 from Fernanda Hansen P. de Moraes Thesis - Cortical folding alterations in humans due to aging and diseases

Description of the procedures and analysis present in Manuscript 1, Independent morphological correlates to aging, Mild Cognitive Impairment, and Alzheimer’s Disease, at the Doctorate Thesis presented to the Programa de Pós-Graduação em Ciências Médicas at the Instituto D’Or de Pesquisa e Ensino as a partial requirement to obtain the Doctorate Degree.

Part of the data used here cannot be shared due to restrictions of the Ethic Committee. Data can be shared upon reasonable request to the corresponding author. To fulfill these limitation, we will generate random data to simulate the results.

Get in touch with us () in case any help is needed, our aim is to improve the code as needed!

1 RMARKDOWN AND R SETUP

setwd("D:/GitHub/CorticalFolding_AD_Aging")
## define functions

# test angular coeficinet versus theoretical value
test_coef <- function(reg, coefnum, val){
  co <- coef(summary(reg))
  tstat <- (co[coefnum,1] - val)/co[coefnum,2]
  2 * pt(abs(tstat), reg$df.residual, lower.tail = FALSE)
}

# wrap text
wrapper <- function(x, ...) paste(strwrap(x, ...), collapse = "\n")
library(readr)
library(readxl)
library(tidyverse)
library(lubridate)
library(ggpubr)
library(kableExtra)
library(broom)
library(MASS)
library(cutpointr)
library(ggstatsplot)
library(effects)
library(car)
# library(multcomp)
library(emmeans)
library(compute.es)
# COLOR BLIND PALETTE WITH BLACK
cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
cbbPalette2 <- c("#D55E00", "#E69F00", "#56B4E9", "#0072B2", "#CC79A7", "#009E73", "#F0E442")

2 set seed for random process

set.seed(1)
dados_raw <- read_csv("dados_raw.csv")

3 DATA PREPARATION

# estimate cortical folding variables
dados_raw <- dados_raw %>%
  mutate(
    # create new variables
    logAvgThickness = log10(AvgThickness),
    logTotalArea = log10(TotalArea),
    logExposedArea = log10(ExposedArea),
    localGI = TotalArea / ExposedArea,
    k = sqrt(AvgThickness) * TotalArea / (ExposedArea ^ 1.25),
    K = 1 / 4 * log10(AvgThickness ^ 2)  + log10(TotalArea) - 5 / 4 * log10(ExposedArea),
    S = 3 / 2 * log10(TotalArea) + 3 / 4 * log10(ExposedArea) - 9 /  4 * log10(AvgThickness ^
                                                                                 2) ,
    I = log10(TotalArea) + log10(ExposedArea) + log10(AvgThickness ^ 2),
    c = as.double(ifelse(
      ROI == "hemisphere", NA, 4 * pi / GaussianCurvature
    )),
    TotalArea_corrected = ifelse(ROI == "hemisphere", TotalArea, TotalArea * c),
    ExposedArea_corrected = ifelse(ROI == "hemisphere", ExposedArea, ExposedArea * c),
    logTotalArea_corrected = log10(TotalArea_corrected),
    logExposedArea_corrected = log10(ExposedArea_corrected),
    localGI_corrected = ifelse(
      ROI == "hemisphere",
      TotalArea / ExposedArea,
      TotalArea_corrected / ExposedArea_corrected
    ),
    k_corrected = ifelse(
      ROI == "hemisphere",
      sqrt(AvgThickness) * log10(TotalArea) / (log10(ExposedArea) ^ 1.25),
      sqrt(AvgThickness) * log10(TotalArea_corrected) / (log10(ExposedArea_corrected ^
                                                                 1.25))
    ),
    K_corrected =  ifelse(
      ROI == "hemisphere",
      1 / 4 * log10(AvgThickness ^ 2) + log10(TotalArea) - 5 / 4 * log10(ExposedArea),
      1 / 4 * log10(AvgThickness ^ 2) + log10(TotalArea_corrected) - 5 / 4 * log10(ExposedArea_corrected)
    ),
    I_corrected = ifelse(
      ROI == "hemisphere",
      log10(TotalArea) + log10(ExposedArea) + log10(AvgThickness ^ 2) ,
      log10(TotalArea_corrected) + log10(ExposedArea_corrected) + log10(AvgThickness ^ 2)
    ),
    S_corrected = ifelse(
      ROI == "hemisphere",
      3 / 2 * log10(TotalArea) + 3 / 4 * log10(ExposedArea) - 9 /  4 * log10(AvgThickness ^ 2) ,
      3 / 2 * log10(TotalArea_corrected) + 3 / 4 * log10(ExposedArea_corrected) - 9 /  4 * log10(AvgThickness ^ 2)
    ),
    Knorm = K_corrected / sqrt(1 + (1 / 4) ^ 2 + (5 / 4) ^ 2),
    Snorm = S_corrected / sqrt((3 / 2) ^ 2 + (3 / 4) ^ 2 + (9 / 4) ^ 2),
    Inorm = I_corrected / sqrt(1 ^ 2 + 1 ^ 2 + 1 ^ 1)
  )

# create age intervals
dados_raw$Age_interval <- cut(dados_raw$Age,
                                       breaks = c(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100),
                                       right = FALSE,
                                       include.lowest = TRUE)

dados_raw$Age_interval10 <- cut(dados_raw$Age,
                                         breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100),
                                         right = FALSE,
                                         include.lowest = TRUE)
dados_all <- dados_raw %>% filter(
    Diagnostic == "CONTROLE" |
      Diagnostic == "CCL" |
      Diagnostic == "ALZ", !is.na(logAvgThickness), ExposedArea != 0 | !is.na(localGI), !is.infinite(logExposedArea)) %>% 
  droplevels()

dados <- dados_all
# rename diagnostics
dados$Diagnostic[dados$Diagnostic == "CONTROLE"] <- "CTL"
dados$Diagnostic[dados$Diagnostic == "ALZ"] <- "AD"
dados$Diagnostic[dados$Diagnostic == "CCL"] <- "MCI"
dados$Diagnostic <- factor(dados$Diagnostic, levels = c("AD", "MCI","CTL"))

# filter data
dados <- dados %>%
  filter(machine == "Philips-Achieva", # include only subjects acquired at Philips Achieva 3T
                          ESC == 8 | ESC > 8, # include only subjects with 8 years of scholarship or more
                          Session == 1) %>% # use only data from Session 1
  droplevels() # delete factor levels

Visual QC exclusion:

VisualQC <- read_excel("Verificacao qualidade segmentacao FS Zika e CCD.xlsx", 
    sheet = "AD - IDOR ses 1 long", col_types = c("text", 
        "text", "skip", "skip", "numeric", 
        "skip", "skip", "skip", "skip", "text", 
        "text")) %>%
  dplyr::select(-c(session)) %>%
  mutate(Session = 1)

dados <- full_join(dados, VisualQC) %>%
  filter(Classification == 1 | Classification == 2)

4 Deaging

# define age for deaging
Age.cor = 25

## Avg thickness ----
decay_AvgThickness <-
  filter(
    dados,
    Diagnostic == "CTL",!is.na(TotalArea),!is.nan(TotalArea),!is.infinite(TotalArea)
  ) %>%
  droplevels() %>%
  group_by(ROI) %>%
  do(fit_decay_AvgThickness = tidy(rlm(AvgThickness ~ Age, data = .), conf.int =
                                     TRUE)) %>%
  unnest(cols = c(fit_decay_AvgThickness)) %>%
  filter(term == "Age") %>%
  mutate(c_AvgThickness = estimate,
         std_error_c_AvgThickness = std.error) %>%
  dplyr::select(c(ROI, c_AvgThickness, std_error_c_AvgThickness))

## TotalArea ----
decay_TotalArea <-
  filter(
    dados,
    Diagnostic == "CTL",
    !is.na(TotalArea),
    !is.nan(TotalArea),
    !is.infinite(TotalArea)
  ) %>%
  droplevels() %>%
  group_by(ROI) %>%
  do(fit_decay_TotalArea = tidy(rlm(TotalArea ~ Age, data = .), conf.int =
                                  TRUE)) %>%
  unnest(cols = c(fit_decay_TotalArea)) %>%
  filter(term == "Age") %>%
  mutate(c_TotalArea = estimate,
         std_error_c_TotalArea = std.error) %>%
  dplyr::select(c(ROI, c_TotalArea, std_error_c_TotalArea))

## ExposedArea ----
decay_ExposedArea <-
  filter(
    dados,
    Diagnostic == "CTL",
    !is.na(ExposedArea),
    !is.nan(ExposedArea),
    !is.infinite(ExposedArea)
  ) %>%
  droplevels() %>%
  group_by(ROI) %>%
  do(fit_decay_ExposedArea = tidy(rlm(ExposedArea ~ Age, data = .), conf.int = TRUE)) %>%
  unnest(cols = c(fit_decay_ExposedArea)) %>%
  filter(term == "Age") %>%
  mutate(c_ExposedArea = estimate,
         std_error_c_ExposedArea = std.error) %>%
  dplyr::select(c(ROI, c_ExposedArea, std_error_c_ExposedArea))

## join
dados <- full_join(dados, decay_AvgThickness) %>%
  full_join(decay_TotalArea) %>%
  full_join(decay_ExposedArea) %>%
  mutate(
    AvgThickness_age_decay = AvgThickness - c_AvgThickness * (Age - Age.cor),
    logAvgThickness_age_decay = log10(AvgThickness_age_decay),
    TotalArea_age_decay = TotalArea - c_TotalArea * (Age - Age.cor),
    logTotalArea_age_decay = log10(TotalArea_age_decay),
    ExposedArea_age_decay = ExposedArea - c_ExposedArea * (Age - Age.cor),
    logExposedArea_age_decay = log10(ExposedArea_age_decay),
    localGI_age_decay = TotalArea_age_decay / ExposedArea_age_decay,
    K_age_decay = log10(TotalArea_age_decay) + 1/4*log10(AvgThickness_age_decay^2) - 5/4*log10(ExposedArea_age_decay),
    I_age_decay = log10(TotalArea_age_decay) + log10(ExposedArea_age_decay) + log10(AvgThickness_age_decay^2),
    S_age_decay = 3/2*log10(TotalArea_age_decay) + 3/4*log10(ExposedArea_age_decay) - 9/4*log10(AvgThickness_age_decay^2))

dados$logAvgThickness <- as.double(dados$logAvgThickness)
dados$logExposedArea <- as.double(dados$logExposedArea)
dados$logTotalArea   <- as.double(dados$logTotalArea)
dados_v1 <- filter(dados, ROI == "F" | ROI == "T" | ROI == "O" | ROI == "P" | ROI == "hemisphere") %>%
  droplevels()

# lobe data
dados_lobos_v1 <- unique(filter(dados, ROI == "F" | ROI == "T" | ROI == "O" | ROI == "P",  !is.na(K_age_decay), SUBJ != "SUBJ211", SUBJ != "SUBJ223")) %>%
  droplevels()

# hemisphere data
dados_hemi_v1 <- unique(filter(dados, ROI == "hemisphere", !is.na(K_age_decay)))

5 RESULTS

5.1 Data description

## # A tibble: 3 × 5
##   Diagnostic     N age      age_range ESC     
##   <fct>      <int> <chr>    <chr>     <chr>   
## 1 AD            13 77 ± 6.1 63 ;  86  13 ± 3  
## 2 MCI           31 72 ± 4.8 62 ;  82  13 ± 2.4
## 3 CTL           77 66 ± 8.4 43 ;  80  15 ± 2.2
## # A tibble: 6 × 3
## # Groups:   Diagnostic [3]
##   Diagnostic Gender     N
##   <fct>      <chr>  <int>
## 1 AD         FEM        8
## 2 AD         MASC       5
## 3 MCI        FEM       19
## 4 MCI        MASC      12
## 5 CTL        FEM       53
## 6 CTL        MASC      24
## # A tibble: 3 × 5
##   Diagnostic     N AvgThickness TotalArea    ExposedArea 
##   <fct>      <int> <chr>        <chr>        <chr>       
## 1 AD            13 2.4 ± 0.079  95000 ± 9300 37000 ± 3000
## 2 MCI           31 2.5 ± 0.088  97000 ± 8200 37000 ± 2600
## 3 CTL           77 2.5 ± 0.099  98000 ± 7800 37000 ± 2400
## # A tibble: 3 × 6
##   Diagnostic     N k             K             S          I         
##   <fct>      <int> <chr>         <chr>         <chr>      <chr>     
## 1 AD            13 0.28 ± 0.01   -0.55 ± 0.015 9.2 ± 0.13 10 ± 0.069
## 2 MCI           31 0.29 ± 0.0094 -0.53 ± 0.014 9.1 ± 0.13 10 ± 0.059
## 3 CTL           77 0.3 ± 0.0095  -0.52 ± 0.014 9.1 ± 0.1  10 ± 0.072
## # A tibble: 3 × 3
##   Diagnostic     N COGNITIVE_INDEX
##   <fct>      <int> <chr>          
## 1 AD            13 -3.4 ± 1.5     
## 2 MCI           31 -1.5 ± 1.3     
## 3 CTL           77 0.21 ± 0.64
## # A tibble: 3 × 5
##   Diagnostic     N `A7/A5`     `TMT B-A` `DIGIT SPAN BACK`
##   <fct>      <int> <chr>       <chr>     <chr>            
## 1 AD            13 0.24 ± 0.31 230 ± 130 3.8 ± 1.4        
## 2 MCI           31 0.53 ± 0.31 130 ± 110 4.6 ± 1.6        
## 3 CTL           77 0.82 ± 0.18 59 ± 48   5.8 ± 1.7
## # A tibble: 3 × 3
##   Diagnostic     N Lipoxin 
##   <fct>      <int> <chr>   
## 1 AD             6 79 ± 74 
## 2 MCI           11 120 ± 51
## 3 CTL           28 130 ± 62
## # A tibble: 3 × 5
##   Diagnostic     N `AB1-40`    `AB1-42`  TAU      
##   <fct>      <int> <chr>       <chr>     <chr>    
## 1 AD             6 5700 ± 1700 280 ± 60  630 ± 280
## 2 MCI           11 5000 ± 2600 450 ± 320 470 ± 200
## 3 CTL           29 4200 ± 1900 530 ± 240 350 ± 190

5.1.1 Stats tests

5.1.1.1 Age

summary(aov(Age ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2   3860  1929.9   35.03 4.56e-14 ***
## Residuals   239  13167    55.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(Age ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Age ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff        lwr        upr     p adj
## MCI-AD   -4.795676  -8.885726 -0.7056261 0.0168180
## CTL-AD  -11.214709 -14.926290 -7.5031268 0.0000000
## CTL-MCI  -6.419032  -9.051969 -3.7860952 0.0000001

5.1.1.2 Education

summary(aov(ESC ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2  286.7  143.35   25.96 6.26e-11 ***
## Residuals   239 1319.6    5.52                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(ESC ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ESC ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff        lwr      upr     p adj
## MCI-AD  0.5136476 -0.7811523 1.808448 0.6183314
## CTL-AD  2.6053946  1.4304075 3.780382 0.0000011
## CTL-MCI 2.0917470  1.2582298 2.925264 0.0000000

5.1.1.3 T

summary(aov(AvgThickness ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.4317 0.21586   24.38 2.31e-10 ***
## Residuals   239 2.1159 0.00885                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(AvgThickness ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = AvgThickness ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff        lwr        upr     p adj
## MCI-AD  0.08062434 0.02877651 0.13247217 0.0008791
## CTL-AD  0.13152344 0.08447329 0.17857360 0.0000000
## CTL-MCI 0.05089910 0.01752248 0.08427573 0.0011369

5.1.1.4 AT

summary(aov(TotalArea ~ Diagnostic, data = dados_hemi_v1))
##              Df    Sum Sq   Mean Sq F value Pr(>F)  
## Diagnostic    2 3.116e+08 155795551   2.385 0.0943 .
## Residuals   239 1.561e+10  65317698                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(TotalArea ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = TotalArea ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff        lwr      upr     p adj
## MCI-AD  1620.774 -2832.6439 6074.192 0.6670748
## CTL-AD  3310.973  -730.3529 7352.298 0.1318996
## CTL-MCI 1690.199 -1176.6532 4557.051 0.3475106

5.1.1.5 AE

summary(aov(ExposedArea ~ Diagnostic, data = dados_hemi_v1))
##              Df    Sum Sq Mean Sq F value Pr(>F)
## Diagnostic    2 7.095e+06 3547305   0.557  0.573
## Residuals   239 1.521e+09 6363529
TukeyHSD(aov(ExposedArea ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ExposedArea ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff        lwr      upr     p adj
## MCI-AD  -51.82309 -1441.8622 1338.216 0.9957469
## CTL-AD  318.18671  -943.2267 1579.600 0.8229883
## CTL-MCI 370.00980  -524.8168 1264.836 0.5932532

5.1.1.6 k

summary(aov(k ~ Diagnostic, data = dados_hemi_v1))
##              Df   Sum Sq   Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.005054 0.0025272   27.75 1.46e-11 ***
## Residuals   239 0.021770 0.0000911                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(k ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = k ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr         upr     p adj
## MCI-AD  0.010302216 0.005043183 0.015561248 0.0000187
## CTL-AD  0.014710931 0.009938538 0.019483325 0.0000000
## CTL-MCI 0.004408716 0.001023255 0.007794176 0.0066995

5.1.1.7 K

summary(aov(K ~ Diagnostic, data = dados_hemi_v1))
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01123 0.005617   28.51 7.88e-12 ***
## Residuals   239 0.04709 0.000197                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(K ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007779038 0.02324848 0.0000114
## CTL-AD  0.021969964 0.014950967 0.02898896 0.0000000
## CTL-MCI 0.006456205 0.001477040 0.01143537 0.0069835

5.1.1.8 S

summary(aov(S ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## Diagnostic    2 0.1454 0.07269   5.935 0.00305 **
## Residuals   239 2.9273 0.01225                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(S ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = S ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr          upr     p adj
## MCI-AD  -0.05354432 -0.11452812  0.007439493 0.0981486
## CTL-AD  -0.07844671 -0.13378745 -0.023105971 0.0027564
## CTL-MCI -0.02490239 -0.06416023  0.014355446 0.2946500

5.1.1.9 I

summary(aov(I ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.1164 0.05820   12.33 8.02e-06 ***
## Residuals   239 1.1282 0.00472                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(I ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = I ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff          lwr        upr     p adj
## MCI-AD  0.03630915 -0.001550483 0.07416878 0.0632732
## CTL-AD  0.06616956  0.031813228 0.10052589 0.0000263
## CTL-MCI 0.02986041  0.005488575 0.05423225 0.0116926

5.1.1.10 COGNITIVE_INDEX

summary(aov(COGNITIVE_INDEX ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value Pr(>F)    
## Diagnostic    2    347  173.49   188.4 <2e-16 ***
## Residuals   239    220    0.92                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(COGNITIVE_INDEX ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = COGNITIVE_INDEX ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff      lwr      upr p adj
## MCI-AD  1.852171 1.323438 2.380904     0
## CTL-AD  3.557509 3.077702 4.037317     0
## CTL-MCI 1.705339 1.364971 2.045707     0

5.1.1.11 A7/A5

summary(aov(`A7/A5` ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value Pr(>F)    
## Diagnostic    2  9.661   4.831   87.88 <2e-16 ***
## Residuals   239 13.137   0.055                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(`A7/A5` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `A7/A5` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff       lwr       upr p adj
## MCI-AD  0.2960104 0.1668189 0.4252020 5e-07
## CTL-AD  0.5878375 0.4706006 0.7050745 0e+00
## CTL-MCI 0.2918271 0.2086611 0.3749931 0e+00

5.1.1.12 TMT B-A

summary(aov(`TMT B-A` ~ Diagnostic, data = dados_hemi_v1))
##              Df  Sum Sq Mean Sq F value Pr(>F)    
## Diagnostic    2  730405  365202   58.35 <2e-16 ***
## Residuals   239 1495797    6259                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(`TMT B-A` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `TMT B-A` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff        lwr        upr p adj
## MCI-AD   -96.98263 -140.57549  -53.38977 1e-06
## CTL-AD  -168.15984 -207.71888 -128.60080 0e+00
## CTL-MCI  -71.17721  -99.23976  -43.11466 0e+00

5.1.1.13 Digit Span Backwards

summary(aov(`DIGIT SPAN BACK` ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2  138.6   69.30   24.95 1.45e-10 ***
## Residuals   239  664.0    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(`DIGIT SPAN BACK` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `DIGIT SPAN BACK` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff        lwr      upr     p adj
## MCI-AD  0.8114144 -0.1070322 1.729861 0.0953982
## CTL-AD  2.0749251  1.2414660 2.908384 0.0000000
## CTL-MCI 1.2635107  0.6722680 1.854753 0.0000027

5.1.1.14 Lipoxin

summary(aov(Lipoxina ~ Diagnostic, data = dados_hemi_v1))
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Diagnostic   2  22927   11464   3.092 0.0504 .
## Residuals   87 322577    3708                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 152 observations deleted due to missingness
TukeyHSD(aov(Lipoxina ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Lipoxina ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff        lwr      upr     p adj
## MCI-AD  37.03091 -15.075120 89.13694 0.2130340
## CTL-AD  48.05357   1.866513 94.24063 0.0395011
## CTL-MCI 11.02266 -25.510935 47.55626 0.7526835

5.1.1.15 AB1-40

summary(aov(`AB1-40` ~ Diagnostic, data = dados_hemi_v1))
##             Df    Sum Sq  Mean Sq F value Pr(>F)  
## Diagnostic   2  26528248 13264124   3.136 0.0483 *
## Residuals   89 376438438  4229645                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 150 observations deleted due to missingness
TukeyHSD(aov(`AB1-40` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `AB1-40` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff       lwr        upr     p adj
## MCI-AD   -674.4154 -2433.610 1084.77885 0.6330672
## CTL-AD  -1472.1773 -3026.785   82.42997 0.0673274
## CTL-MCI  -797.7619 -2025.190  429.66585 0.2731864

5.1.1.16 AB1-42

summary(aov(`AB1-42` ~ Diagnostic, data = dados_hemi_v1))
##             Df  Sum Sq Mean Sq F value Pr(>F)   
## Diagnostic   2  666278  333139   5.367 0.0063 **
## Residuals   89 5524285   62071                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 150 observations deleted due to missingness
TukeyHSD(aov(`AB1-42` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `AB1-42` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff       lwr      upr     p adj
## MCI-AD  172.9624 -40.14814 386.0729 0.1350205
## CTL-AD  254.2086  65.88193 442.5352 0.0050847
## CTL-MCI  81.2462 -67.44560 229.9380 0.3976177

5.1.1.17 TAU

summary(aov(TAU ~ Diagnostic, data = dados_hemi_v1))
##             Df  Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic   2  840654  420327    9.61 0.000166 ***
## Residuals   89 3892705   43738                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 150 observations deleted due to missingness
TukeyHSD(aov(TAU ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = TAU ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff       lwr         upr     p adj
## MCI-AD  -161.7855 -340.6782   17.107122 0.0846567
## CTL-AD  -277.1303 -435.2185 -119.042116 0.0002006
## CTL-MCI -115.3448 -240.1620    9.472512 0.0762203

5.2 Cortical Folding Model

summary(lm(
  1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
  data = dados_hemi_v1,
  na.action = na.omit
))
## 
## Call:
## lm(formula = 1/2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea), 
##     data = dados_hemi_v1, na.action = na.omit)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.044511 -0.009410  0.000803  0.010885  0.035521 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        -0.009399   0.153570  -0.061    0.951    
## log10(ExposedArea)  1.136373   0.033594  33.827   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01523 on 240 degrees of freedom
## Multiple R-squared:  0.8266, Adjusted R-squared:  0.8259 
## F-statistic:  1144 on 1 and 240 DF,  p-value: < 2.2e-16
# Displays confidence interval
tidy(lm(
  1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
  data = dados_hemi_v1,
  na.action = na.omit
), conf.int = TRUE)
## # A tibble: 2 × 7
##   term               estimate std.error statistic  p.value conf.low conf.high
##   <chr>                 <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
## 1 (Intercept)        -0.00940    0.154    -0.0612 9.51e- 1   -0.312     0.293
## 2 log10(ExposedArea)  1.14       0.0336   33.8    2.70e-93    1.07      1.20
paste(
  "Student's t test comparing slope with theoretical value 1.25. t = ",
  signif(abs(coef(summary(
    lm(
      1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
      data = dados_hemi_v1,
      na.action = na.omit
    )
  ))[2, 1] - 1.25) / coef(summary(
    lm(
      1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
      data = dados_hemi_v1,
      na.action = na.omit
    )
  ))[2, 2], 3) 
)
## [1] "Student's t test comparing slope with theoretical value 1.25. t =  3.38"
paste(
  "Student's t test comparing slope with theoretical value 1.25. p value = ",
  signif(test_coef(
    lm(
      1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
      data = dados_hemi_v1,
      na.action = na.omit
    ),
    2,
    1.25
  ),3)
)
## [1] "Student's t test comparing slope with theoretical value 1.25. p value =  0.000839"

5.2.0.1 Diagnostic

dados_hemi_v1 %>%
  group_by(Diagnostic) %>%
  do(fit_Age = tidy(
    lm(
      1 / 2 * log10(AvgThickness) +  log10(TotalArea) ~  log10(ExposedArea),
      data = .,
      na.action = na.omit
    ),
    conf.int = TRUE
  )) %>%
  unnest(cols = c(Diagnostic))
## # A tibble: 3 × 2
##   Diagnostic fit_Age         
##   <fct>      <list>          
## 1 AD         <tibble [2 × 7]>
## 2 MCI        <tibble [2 × 7]>
## 3 CTL        <tibble [2 × 7]>

5.3 Correlation within cortical fodling variables and age healthy subjects)

5.3.1 Slope alpha

lm_Age <-
  filter(
    dados_hemi_v1,
    Diagnostic == "CTL",
    Age_interval != "[40,45)",
    Age_interval != "[80,85)"
  ) %>%
  group_by(Age_interval) %>%
  do(fit_Age = tidy(
    lm(
      1 / 2 * log10(AvgThickness) +  log10(TotalArea) ~  log10(ExposedArea),
      data = .,
      na.action = na.omit
    ),
    conf.int = TRUE
  )) %>%
  unnest(cols = c(fit_Age))

lm_Age <- lm_Age %>% mutate(Age_interval = as.double((str_sub(Age_interval,2,3))))

cor <- cor.test(filter(lm_Age, term == "log10(ExposedArea)")$estimate, filter(lm_Age, term == "log10(ExposedArea)")$Age_interval)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(lm_Age, term == "log10(ExposedArea)")$estimate and filter(lm_Age, term == "log10(ExposedArea)")$Age_interval
## t = -2.8822, df = 5, p-value = 0.0345
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.96750265 -0.09146064
## sample estimates:
##        cor 
## -0.7901004
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = -2.58 [ -6.62 , 1.47 ] 
##   var(d) = 4.26 
##   p-value(d) = 0.32 
##   U3(d) = 0.5 % 
##   CLES(d) = 3.42 % 
##   Cliff's Delta = -0.93 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = -0.79 [ -1 , 0.94 ] 
##   var(r) = 0.06 
##   p-value(r) = 0.51 
##  
##  z [ 95 %CI] = -1.07 [ -3.84 , 1.7 ] 
##   var(z) = 2 
##   p-value(z) = 0.51 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 0.01 [ 0 , 14.3 ] 
##   p-value(OR) = 0.32 
##  
##  Log OR [ 95 %CI] = -4.68 [ -12.01 , 2.66 ] 
##   var(lOR) = 14.01 
##   p-value(Log OR) = 0.32 
##  
##  Other: 
##  
##  NNT = -5.01 
##  Total N = 3.5
res$d
## [1] -2.58
res$l.d
## [1] -6.62
res$u.d
## [1] 1.47

5.3.2 K

cor <- cor.test(filter(dados_hemi_v1, Diagnostic == "CTL")$K, filter(dados_hemi_v1, Diagnostic == "CTL")$Age)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "CTL")$K and filter(dados_hemi_v1, Diagnostic == "CTL")$Age
## t = -4.176, df = 152, p-value = 4.981e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4558437 -0.1713459
## sample estimates:
##        cor 
## -0.3208125
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = -0.68 [ -1.15 , -0.2 ] 
##   var(d) = 0.06 
##   p-value(d) = 0.01 
##   U3(d) = 24.91 % 
##   CLES(d) = 31.6 % 
##   Cliff's Delta = -0.37 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = -0.32 [ -0.51 , -0.1 ] 
##   var(r) = 0.01 
##   p-value(r) = 0.01 
##  
##  z [ 95 %CI] = -0.33 [ -0.56 , -0.1 ] 
##   var(z) = 0.01 
##   p-value(z) = 0.01 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 0.29 [ 0.12 , 0.69 ] 
##   p-value(OR) = 0.01 
##  
##  Log OR [ 95 %CI] = -1.23 [ -2.09 , -0.37 ] 
##   var(lOR) = 0.19 
##   p-value(Log OR) = 0.01 
##  
##  Other: 
##  
##  NNT = -7.37 
##  Total N = 77
res$d
## [1] -0.68
res$l.d
## [1] -1.15
res$u.d
## [1] -0.2

5.3.2.1 Diagnostic

cor.test(filter(dados_hemi_v1, Diagnostic == "AD")$K, filter(dados_hemi_v1, Diagnostic == "AD")$Age)
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "AD")$K and filter(dados_hemi_v1, Diagnostic == "AD")$Age
## t = -1.2939, df = 24, p-value = 0.208
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5848606  0.1464815
## sample estimates:
##        cor 
## -0.2553595
cor.test(filter(dados_hemi_v1, Diagnostic == "MCI")$K, filter(dados_hemi_v1, Diagnostic == "MCI")$Age)
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "MCI")$K and filter(dados_hemi_v1, Diagnostic == "MCI")$Age
## t = -1.8932, df = 60, p-value = 0.06315
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.45991952  0.01312119
## sample estimates:
##        cor 
## -0.2374251

5.3.3 S

cor <- cor.test(filter(dados_hemi_v1, Diagnostic == "CTL")$S, filter(dados_hemi_v1, Diagnostic == "CTL")$Age)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "CTL")$S and filter(dados_hemi_v1, Diagnostic == "CTL")$Age
## t = 1.546, df = 152, p-value = 0.1242
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03441253  0.27713228
## sample estimates:
##       cor 
## 0.1244254
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = 0.25 [ -0.2 , 0.7 ] 
##   var(d) = 0.05 
##   p-value(d) = 0.28 
##   U3(d) = 59.9 % 
##   CLES(d) = 57.04 % 
##   Cliff's Delta = 0.14 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = 0.12 [ -0.1 , 0.34 ] 
##   var(r) = 0.01 
##   p-value(r) = 0.29 
##  
##  z [ 95 %CI] = 0.13 [ -0.1 , 0.35 ] 
##   var(z) = 0.01 
##   p-value(z) = 0.29 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 1.58 [ 0.69 , 3.59 ] 
##   p-value(OR) = 0.28 
##  
##  Log OR [ 95 %CI] = 0.45 [ -0.37 , 1.28 ] 
##   var(lOR) = 0.18 
##   p-value(Log OR) = 0.28 
##  
##  Other: 
##  
##  NNT = 12.93 
##  Total N = 77
res$d
## [1] 0.25
res$l.d
## [1] -0.2
res$u.d
## [1] 0.7

5.3.4 I

cor <- cor.test(filter(dados_hemi_v1, Diagnostic == "CTL")$I, filter(dados_hemi_v1, Diagnostic == "CTL")$Age)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "CTL")$I and filter(dados_hemi_v1, Diagnostic == "CTL")$Age
## t = -6.6178, df = 152, p-value = 5.879e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5871863 -0.3402379
## sample estimates:
##        cor 
## -0.4729482
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = -1.07 [ -1.58 , -0.56 ] 
##   var(d) = 0.07 
##   p-value(d) = 0 
##   U3(d) = 14.15 % 
##   CLES(d) = 22.39 % 
##   Cliff's Delta = -0.55 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = -0.47 [ -0.63 , -0.28 ] 
##   var(r) = 0.01 
##   p-value(r) = 0 
##  
##  z [ 95 %CI] = -0.51 [ -0.74 , -0.29 ] 
##   var(z) = 0.01 
##   p-value(z) = 0 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 0.14 [ 0.06 , 0.36 ] 
##   p-value(OR) = 0 
##  
##  Log OR [ 95 %CI] = -1.95 [ -2.87 , -1.02 ] 
##   var(lOR) = 0.22 
##   p-value(Log OR) = 0 
##  
##  Other: 
##  
##  NNT = -5.81 
##  Total N = 77
res$d
## [1] -1.07
res$l.d
## [1] -1.58
res$u.d
## [1] -0.56

5.3.5 data sharing - FIGURE 1

datafig1 <- dados_hemi_v1 %>%
  dplyr::select(c(Age, Diagnostic, AvgThickness, TotalArea, ExposedArea, K)) %>%
  mutate(x = log10(ExposedArea),
         y = log10(sqrt(AvgThickness) * TotalArea)) %>%
  dplyr::select(c(Age, Diagnostic, x, y, K))
write.csv(datafig1, "datafig1.csv")

FIGURE 1

fig2a <- ggplot(dados_hemi_v1,
                aes(
                  log10(ExposedArea),
                  log10(sqrt(AvgThickness) * TotalArea),
                  color = Diagnostic,
                  fill = Diagnostic,
                  alpha = 0.4
                )) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  geom_abline(slope = 1.25,
              intercept = coef(lm(
                log10(sqrt(AvgThickness) * TotalArea) ~ log10(ExposedArea),
                data = dados_hemi_v1,
                na.action = na.omit
              ))[1],
              color = "black") +
  labs(x = bquote(log[10]*A[E] ~ "["*mm^2*"]"),
       y = bquote(log[10]*A[T]*sqrt(T) ~ "["*mm^(3/2)*"]")) +
  guides(alpha = "none") +
  theme_pubr() +
  scale_x_continuous(limits = c(4.45, 4.65)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
fig1b <- ggplot(data = dados_hemi_v1, aes(Age, K, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]", y = "K [dimentionless]") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
fig1_alt_2 <-
  ggarrange(
    fig2a,
    fig1b,
    labels = c("A", "B"),
    ncol = 2,
    nrow = 1,
    common.legend = TRUE,
    legend = "bottom"
  )

ggsave("Figure1.png", plot = fig1_alt_2, width = 18, height = 9, units = "cm", device = "png")
ggsave("Figure1.pdf", plot = fig1_alt_2, width = 18, height = 9, units = "cm", device = "pdf")

#ggsave("fig1_alt_2.pdf", plot = fig1_alt_2, dpi=1200, width = 9, height = 11.37, units = "cm", device = "pdf")
fig1_alt_2
\label{fig:figure1}Age and diagnostic effects in cortical gyrification. We included 77~CTL (blue), 33~MCI (green) and 13~AD (red) subjects. (A) Linear fitting with 95% Confidence Interval (CI) for the model variables in each Diagnostic group, CTL (adjusted R²~=~0.85, p~<~0.0001), MCI (adjusted R²~=~0.88, p~<~0.0001), and AD (adjusted R²~=~0.86, p~<~0.0001). As the severity of the disease increase, the linear tendency is downshifted, with smaller linear intercepts (K). (B) K linear tendency across age with 95% CI for the three diagnostics groups: AD (adjusted R²~=~0.026, p~=~0.21), MCI (adjusted R²~=~0.044, p~=~0.0051), and CTL (adjusted R²~=~0.097, p~<~0.0001)

Age and diagnostic effects in cortical gyrification. We included 77~CTL (blue), 33~MCI (green) and 13~AD (red) subjects. (A) Linear fitting with 95% Confidence Interval (CI) for the model variables in each Diagnostic group, CTL (adjusted R²=0.85, p<0.0001), MCI (adjusted R²=0.88, p<0.0001), and AD (adjusted R²=0.86, p<0.0001). As the severity of the disease increase, the linear tendency is downshifted, with smaller linear intercepts (K). (B) K linear tendency across age with 95% CI for the three diagnostics groups: AD (adjusted R²=0.026, p=0.21), MCI (adjusted R²=0.044, p=0.0051), and CTL (adjusted R²=0.097, p<0.0001)

5.4 Diagnostic discrimination

5.4.1 K difference

aov <- aov(K ~ Diagnostic, data = dados_hemi_v1)
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01123 0.005617   28.51 7.88e-12 ***
## Residuals   239 0.04709 0.000197                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007779038 0.02324848 0.0000114
## CTL-AD  0.021969964 0.014950967 0.02898896 0.0000000
## CTL-MCI 0.006456205 0.001477040 0.01143537 0.0069835
aov <- aov(K ~ Diagnostic + Gender + ESC, data = dados_hemi_v1)
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01123 0.005617  29.128 4.89e-12 ***
## Gender        1 0.00130 0.001301   6.745  0.00999 ** 
## ESC           1 0.00009 0.000087   0.452  0.50188    
## Residuals   237 0.04570 0.000193                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov, which = "Diagnostic")
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic + Gender + ESC, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007861380 0.02316614 0.0000091
## CTL-AD  0.021969964 0.015025689 0.02891424 0.0000000
## CTL-MCI 0.006456205 0.001530047 0.01138236 0.0062983

5.4.2 K is reduced with age, as cortical thickness, total area and exposed area

K decrease with age is shown on Figure 1 B. Cortical Thickness, Total area and Exposed area:

T <- ggplot(data = dados_hemi_v1, aes(Age, AvgThickness, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

AT <- ggplot(data = dados_hemi_v1, aes(Age, TotalArea, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]", y = "Total Area 10^-5 ") +
  scale_y_continuous(
    labels = function(x)
      x / 10000) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

AE <- ggplot(data = dados_hemi_v1, aes(Age, ExposedArea, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]", y = "Exposed Area 10^-5 ") +
  scale_y_continuous(
    labels = function(x)
      x / 10000) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
ggarrange(T, AT, AE, ncol = 1, common.legend = TRUE, legend = "bottom")

5.4.3 Lobes diagnostic discrimination

5.4.3.1 Frontal Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "F"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.00921 0.004607   15.04 7.14e-07 ***
## Residuals   235 0.07198 0.000306                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "F"))
## 
## $Diagnostic
##                diff           lwr        upr     p adj
## MCI-AD  0.013855899  0.0041879684 0.02352383 0.0024340
## CTL-AD  0.019888810  0.0111241119 0.02865351 0.0000006
## CTL-MCI 0.006032911 -0.0002294776 0.01229530 0.0617486

5.4.3.2 Occipital Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "O"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01091 0.005455    10.1 6.18e-05 ***
## Residuals   235 0.12689 0.000540                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "O"))
## 
## $Diagnostic
##                diff          lwr        upr     p adj
## MCI-AD  0.014642877  0.001806195 0.02747956 0.0208079
## CTL-AD  0.021529149  0.009891742 0.03316656 0.0000568
## CTL-MCI 0.006886272 -0.001428671 0.01520122 0.1262601

5.4.3.3 Parietal Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "P"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01261 0.006304   16.82 1.49e-07 ***
## Residuals   235 0.08807 0.000375                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "P"))
## 
## $Diagnostic
##               diff         lwr         upr     p adj
## MCI-AD  0.02207297  0.01137842 0.032767522 0.0000062
## CTL-AD  0.02369360  0.01399820 0.033389007 0.0000001
## CTL-MCI 0.00162063 -0.00530675 0.008548009 0.8456570

5.4.3.4 Temporal Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "T"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value  Pr(>F)    
## Diagnostic    2 0.01908 0.009542   27.61 1.7e-11 ***
## Residuals   235 0.08122 0.000346                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "T"))
## 
## $Diagnostic
##               diff         lwr        upr     p adj
## MCI-AD  0.01624932 0.005979382 0.02651925 0.0006953
## CTL-AD  0.02747185 0.018161394 0.03678231 0.0000000
## CTL-MCI 0.01122254 0.004570201 0.01787487 0.0002710

5.4.4 Difference in K between diagnostics decrease with age?

We compared age intervals of 10 years to increase N at each comparison.

5.4.4.1 K

Linear model for visual inspection:

b <- lm(K ~ Age * ROI * Diagnostic, data = dados)
summary(b)
## 
## Call:
## lm(formula = K ~ Age * ROI * Diagnostic, data = dados)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.062579 -0.011983  0.000438  0.012537  0.061381 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     -4.175e-01  4.625e-02  -9.026   <2e-16 ***
## Age                             -9.139e-04  5.982e-04  -1.528   0.1269    
## ROIhemisphere                   -7.977e-02  6.541e-02  -1.219   0.2229    
## ROIO                             7.811e-02  6.541e-02   1.194   0.2327    
## ROIP                             1.091e-01  6.541e-02   1.667   0.0957 .  
## ROIT                             7.845e-02  6.541e-02   1.199   0.2306    
## DiagnosticMCI                   -3.406e-02  5.779e-02  -0.589   0.5557    
## DiagnosticCTL                   -1.502e-02  4.777e-02  -0.315   0.7532    
## Age:ROIhemisphere                2.715e-04  8.460e-04   0.321   0.7483    
## Age:ROIO                         4.846e-04  8.460e-04   0.573   0.5669    
## Age:ROIP                         5.873e-05  8.460e-04   0.069   0.9447    
## Age:ROIT                         2.245e-04  8.460e-04   0.265   0.7908    
## Age:DiagnosticMCI                5.879e-04  7.664e-04   0.767   0.4432    
## Age:DiagnosticCTL                3.757e-04  6.245e-04   0.602   0.5475    
## ROIhemisphere:DiagnosticMCI      5.027e-02  8.220e-02   0.612   0.5410    
## ROIO:DiagnosticMCI               3.208e-02  8.173e-02   0.392   0.6948    
## ROIP:DiagnosticMCI               6.215e-02  8.173e-02   0.760   0.4472    
## ROIT:DiagnosticMCI               1.087e-01  8.173e-02   1.331   0.1836    
## ROIhemisphere:DiagnosticCTL      2.221e-02  6.751e-02   0.329   0.7422    
## ROIO:DiagnosticCTL               3.178e-02  6.755e-02   0.470   0.6382    
## ROIP:DiagnosticCTL               1.799e-02  6.755e-02   0.266   0.7901    
## ROIT:DiagnosticCTL               4.475e-02  6.755e-02   0.662   0.5078    
## Age:ROIhemisphere:DiagnosticMCI -6.400e-04  1.090e-03  -0.587   0.5573    
## Age:ROIO:DiagnosticMCI          -4.039e-04  1.084e-03  -0.373   0.7095    
## Age:ROIP:DiagnosticMCI          -7.412e-04  1.084e-03  -0.684   0.4942    
## Age:ROIT:DiagnosticMCI          -1.456e-03  1.084e-03  -1.343   0.1795    
## Age:ROIhemisphere:DiagnosticCTL -2.606e-04  8.826e-04  -0.295   0.7678    
## Age:ROIO:DiagnosticCTL          -3.753e-04  8.832e-04  -0.425   0.6710    
## Age:ROIP:DiagnosticCTL          -2.050e-04  8.832e-04  -0.232   0.8165    
## Age:ROIT:DiagnosticCTL          -5.254e-04  8.832e-04  -0.595   0.5521    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01836 on 1172 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.9403, Adjusted R-squared:  0.9389 
## F-statistic: 636.9 on 29 and 1172 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: K
##                      Df Sum Sq Mean Sq   F value    Pr(>F)    
## Age                   1 0.0585 0.05847  173.5006 < 2.2e-16 ***
## ROI                   4 6.1367 1.53418 4552.3579 < 2.2e-16 ***
## Diagnostic            2 0.0233 0.01164   34.5456 2.646e-15 ***
## Age:ROI               4 0.0028 0.00069    2.0496   0.08531 .  
## Age:Diagnostic        2 0.0002 0.00010    0.2939   0.74544    
## ROI:Diagnostic        8 0.0019 0.00024    0.7142   0.67917    
## Age:ROI:Diagnostic    8 0.0009 0.00012    0.3524   0.94499    
## Residuals          1172 0.3950 0.00034                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "K") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

Removing MCI for clear plots

b <- lm(K ~ Age * ROI * Diagnostic, data = filter(dados, Diagnostic != "MCI"))
summary(b)
## 
## Call:
## lm(formula = K ~ Age * ROI * Diagnostic, data = filter(dados, 
##     Diagnostic != "MCI"))
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.062579 -0.011513  0.000543  0.012219  0.061381 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     -4.175e-01  4.642e-02  -8.993   <2e-16 ***
## Age                             -9.139e-04  6.004e-04  -1.522    0.128    
## ROIhemisphere                   -7.977e-02  6.565e-02  -1.215    0.225    
## ROIO                             7.811e-02  6.565e-02   1.190    0.234    
## ROIP                             1.091e-01  6.565e-02   1.661    0.097 .  
## ROIT                             7.845e-02  6.565e-02   1.195    0.232    
## DiagnosticCTL                   -1.502e-02  4.794e-02  -0.313    0.754    
## Age:ROIhemisphere                2.715e-04  8.491e-04   0.320    0.749    
## Age:ROIO                         4.846e-04  8.491e-04   0.571    0.568    
## Age:ROIP                         5.873e-05  8.491e-04   0.069    0.945    
## Age:ROIT                         2.245e-04  8.491e-04   0.264    0.792    
## Age:DiagnosticCTL                3.757e-04  6.268e-04   0.599    0.549    
## ROIhemisphere:DiagnosticCTL      2.221e-02  6.776e-02   0.328    0.743    
## ROIO:DiagnosticCTL               3.178e-02  6.780e-02   0.469    0.639    
## ROIP:DiagnosticCTL               1.799e-02  6.780e-02   0.265    0.791    
## ROIT:DiagnosticCTL               4.475e-02  6.780e-02   0.660    0.509    
## Age:ROIhemisphere:DiagnosticCTL -2.606e-04  8.859e-04  -0.294    0.769    
## Age:ROIO:DiagnosticCTL          -3.753e-04  8.865e-04  -0.423    0.672    
## Age:ROIP:DiagnosticCTL          -2.050e-04  8.865e-04  -0.231    0.817    
## Age:ROIT:DiagnosticCTL          -5.254e-04  8.865e-04  -0.593    0.554    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01843 on 868 degrees of freedom
## Multiple R-squared:  0.9401, Adjusted R-squared:  0.9388 
## F-statistic: 716.9 on 19 and 868 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: K
##                     Df Sum Sq Mean Sq   F value    Pr(>F)    
## Age                  1 0.0507 0.05069  149.3168 < 2.2e-16 ***
## ROI                  4 4.5483 1.13708 3349.3340 < 2.2e-16 ***
## Diagnostic           1 0.0233 0.02333   68.7283 4.275e-16 ***
## Age:ROI              4 0.0016 0.00040    1.1900    0.3137    
## Age:Diagnostic       1 0.0000 0.00005    0.1337    0.7147    
## ROI:Diagnostic       4 0.0002 0.00005    0.1552    0.9607    
## Age:ROI:Diagnostic   4 0.0001 0.00003    0.0976    0.9832    
## Residuals          868 0.2947 0.00034                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "K") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

5.4.4.2 S

b <- lm(S ~ Age * ROI * Diagnostic, data = dados)
summary(b)
## 
## Call:
## lm(formula = S ~ Age * ROI * Diagnostic, data = dados)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.42942 -0.08443  0.00251  0.08212  0.35780 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      8.2997167  0.3044376  27.262   <2e-16 ***
## Age                             -0.0012310  0.0039376  -0.313   0.7546    
## ROIhemisphere                    0.9512429  0.4305398   2.209   0.0273 *  
## ROIO                            -0.6285586  0.4305398  -1.460   0.1446    
## ROIP                            -0.2881705  0.4305398  -0.669   0.5034    
## ROIT                            -0.8484631  0.4305398  -1.971   0.0490 *  
## DiagnosticMCI                   -0.9129225  0.3804014  -2.400   0.0166 *  
## DiagnosticCTL                   -0.2889535  0.3144115  -0.919   0.3583    
## Age:ROIhemisphere                0.0005630  0.0055686   0.101   0.9195    
## Age:ROIO                        -0.0008315  0.0055686  -0.149   0.8813    
## Age:ROIP                         0.0013346  0.0055686   0.240   0.8106    
## Age:ROIT                         0.0014435  0.0055686   0.259   0.7955    
## Age:DiagnosticMCI                0.0118343  0.0050447   2.346   0.0191 *  
## Age:DiagnosticCTL                0.0029387  0.0041108   0.715   0.4748    
## ROIhemisphere:DiagnosticMCI      0.0593214  0.5410439   0.110   0.9127    
## ROIO:DiagnosticMCI               0.8581515  0.5379688   1.595   0.1109    
## ROIP:DiagnosticMCI               0.1174156  0.5379688   0.218   0.8273    
## ROIT:DiagnosticMCI               0.1581980  0.5379688   0.294   0.7688    
## ROIhemisphere:DiagnosticCTL      0.0607655  0.4443808   0.137   0.8913    
## ROIO:DiagnosticCTL               0.1167024  0.4446450   0.262   0.7930    
## ROIP:DiagnosticCTL               0.0829354  0.4446450   0.187   0.8521    
## ROIT:DiagnosticCTL               0.0912829  0.4446450   0.205   0.8374    
## Age:ROIhemisphere:DiagnosticMCI -0.0008106  0.0071763  -0.113   0.9101    
## Age:ROIO:DiagnosticMCI          -0.0115071  0.0071343  -1.613   0.1070    
## Age:ROIP:DiagnosticMCI          -0.0013543  0.0071343  -0.190   0.8495    
## Age:ROIT:DiagnosticMCI          -0.0025714  0.0071343  -0.360   0.7186    
## Age:ROIhemisphere:DiagnosticCTL -0.0007791  0.0058095  -0.134   0.8933    
## Age:ROIO:DiagnosticCTL          -0.0011890  0.0058135  -0.205   0.8380    
## Age:ROIP:DiagnosticCTL          -0.0005318  0.0058135  -0.091   0.9271    
## Age:ROIT:DiagnosticCTL          -0.0017767  0.0058135  -0.306   0.7600    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1208 on 1172 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.9654, Adjusted R-squared:  0.9646 
## F-statistic:  1128 on 29 and 1172 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: S
##                      Df Sum Sq Mean Sq   F value    Pr(>F)    
## Age                   1   0.46   0.457   31.3054 2.743e-08 ***
## ROI                   4 476.22 119.054 8154.1728 < 2.2e-16 ***
## Diagnostic            2   0.24   0.122    8.3801 0.0002434 ***
## Age:ROI               4   0.14   0.036    2.4546 0.0441904 *  
## Age:Diagnostic        2   0.30   0.152   10.3981 3.340e-05 ***
## ROI:Diagnostic        8   0.08   0.010    0.7096 0.6832655    
## Age:ROI:Diagnostic    8   0.11   0.013    0.8990 0.5164846    
## Residuals          1172  17.11   0.015                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "S") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

5.4.4.3 I

b <- lm(I ~ Age * ROI * Diagnostic, data = dados)
summary(b)
## 
## Call:
## lm(formula = I ~ Age * ROI * Diagnostic, data = dados)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.26868 -0.04955 -0.00019  0.05248  0.36594 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      9.542e+00  1.988e-01  47.994  < 2e-16 ***
## Age                             -7.871e-04  2.572e-03  -0.306  0.75959    
## ROIhemisphere                    8.241e-01  2.812e-01   2.931  0.00344 ** 
## ROIO                            -8.602e-01  2.812e-01  -3.059  0.00227 ** 
## ROIP                            -4.074e-01  2.812e-01  -1.449  0.14763    
## ROIT                            -5.307e-01  2.812e-01  -1.887  0.05937 .  
## DiagnosticMCI                    2.074e-01  2.484e-01   0.835  0.40396    
## DiagnosticCTL                    2.562e-01  2.053e-01   1.248  0.21233    
## Age:ROIhemisphere               -1.168e-04  3.637e-03  -0.032  0.97438    
## Age:ROIO                        -3.853e-03  3.637e-03  -1.059  0.28963    
## Age:ROIP                         1.826e-05  3.637e-03   0.005  0.99599    
## Age:ROIT                         9.093e-04  3.637e-03   0.250  0.80261    
## Age:DiagnosticMCI               -2.451e-03  3.295e-03  -0.744  0.45703    
## Age:DiagnosticCTL               -3.180e-03  2.685e-03  -1.185  0.23640    
## ROIhemisphere:DiagnosticMCI     -2.010e-01  3.533e-01  -0.569  0.56956    
## ROIO:DiagnosticMCI              -6.063e-01  3.513e-01  -1.726  0.08466 .  
## ROIP:DiagnosticMCI              -1.202e-01  3.513e-01  -0.342  0.73231    
## ROIT:DiagnosticMCI              -1.063e-01  3.513e-01  -0.303  0.76223    
## ROIhemisphere:DiagnosticCTL      7.263e-03  2.902e-01   0.025  0.98004    
## ROIO:DiagnosticCTL              -2.995e-01  2.904e-01  -1.031  0.30253    
## ROIP:DiagnosticCTL               1.346e-02  2.904e-01   0.046  0.96303    
## ROIT:DiagnosticCTL               1.367e-01  2.904e-01   0.471  0.63786    
## Age:ROIhemisphere:DiagnosticMCI  2.805e-03  4.687e-03   0.598  0.54964    
## Age:ROIO:DiagnosticMCI           7.990e-03  4.659e-03   1.715  0.08664 .  
## Age:ROIP:DiagnosticMCI           1.594e-03  4.659e-03   0.342  0.73237    
## Age:ROIT:DiagnosticMCI           1.806e-03  4.659e-03   0.388  0.69834    
## Age:ROIhemisphere:DiagnosticCTL  3.065e-05  3.794e-03   0.008  0.99356    
## Age:ROIO:DiagnosticCTL           3.743e-03  3.797e-03   0.986  0.32441    
## Age:ROIP:DiagnosticCTL          -1.230e-04  3.797e-03  -0.032  0.97416    
## Age:ROIT:DiagnosticCTL          -1.218e-03  3.797e-03  -0.321  0.74838    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07891 on 1172 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.9859, Adjusted R-squared:  0.9855 
## F-statistic:  2821 on 29 and 1172 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: I
##                      Df Sum Sq Mean Sq    F value    Pr(>F)    
## Age                   1   1.58   1.577   253.1826 < 2.2e-16 ***
## ROI                   4 507.63 126.907 20379.2427 < 2.2e-16 ***
## Diagnostic            2   0.06   0.032     5.1340  0.006026 ** 
## Age:ROI               4   0.01   0.003     0.4110  0.800848    
## Age:Diagnostic        2   0.08   0.042     6.7432  0.001225 ** 
## ROI:Diagnostic        8   0.04   0.005     0.8379  0.569185    
## Age:ROI:Diagnostic    8   0.03   0.003     0.5435  0.824144    
## Residuals          1172   7.30   0.006                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "I") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

5.4.5 Optimal cut-offs

5.4.5.1 K

## Method: maximize_boot_metric 
## Predictor: K 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.8442 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.5402        1.4341 0.8167      0.5769      0.8571 15 11 22 132
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5705655 -0.5554250 -0.5369054 -0.5277599 -0.5279802 -0.5160266
##       AD -0.5705655 -0.5675134 -0.5595947 -0.5523513 -0.5467767 -0.5315364
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.5553652 -0.5484493 -0.5346425 -0.5249779 -0.5248068 -0.5145646
##         95%       Max.         SD NAs
##  -0.5032479 -0.4974075 0.01602744   0
##  -0.5260303 -0.5225081 0.01543894   0
##          NA         NA         NA   0
##  -0.5028530 -0.4974075 0.01383501   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.55 -0.55   -0.54  -0.54 -0.54   -0.53 -0.53 -0.52 0.01
##              AUC_b  0.67  0.78    0.82   0.85  0.84    0.87  0.90  0.96 0.04
##            AUC_oob  0.60  0.74    0.81   0.85  0.84    0.88  0.93  1.00 0.06
##    sum_sens_spec_b  1.12  1.26    1.37   1.46  1.46    1.55  1.67  1.85 0.12
##  sum_sens_spec_oob  0.85  1.19    1.33   1.42  1.41    1.50  1.62  1.81 0.13
##              acc_b  0.48  0.65    0.72   0.78  0.78    0.85  0.92  0.96 0.08
##            acc_oob  0.49  0.62    0.71   0.78  0.77    0.84  0.90  0.97 0.09
##      sensitivity_b  0.40  0.50    0.58   0.63  0.66    0.71  0.88  1.00 0.11
##    sensitivity_oob  0.00  0.33    0.50   0.60  0.62    0.75  0.93  1.00 0.19
##      specificity_b  0.43  0.63    0.73   0.81  0.80    0.89  0.95  0.99 0.10
##    specificity_oob  0.36  0.58    0.71   0.81  0.79    0.89  0.96  1.00 0.12
##     cohens_kappa_b  0.08  0.16    0.25   0.33  0.36    0.47  0.65  0.83 0.15
##   cohens_kappa_oob -0.08  0.13    0.23   0.31  0.32    0.39  0.53  0.78 0.12
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## Method: maximize_boot_metric 
## Predictor: K 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.6274 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##           -0.5277        1.1295 0.5648      0.5645      0.5649 35 27 67 87
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5680537 -0.5500565 -0.5366192 -0.5269576 -0.5266599 -0.5162116
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.5680537 -0.5529256 -0.5399022 -0.5314849 -0.5312630 -0.5222311
##      CTL -0.5553652 -0.5484493 -0.5346425 -0.5249779 -0.5248068 -0.5145646
##         95%       Max.         SD NAs
##  -0.5045346 -0.4974075 0.01413782   0
##          NA         NA         NA   0
##  -0.5081443 -0.5055914 0.01393539   0
##  -0.5028530 -0.4974075 0.01383501   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.54 -0.53   -0.53  -0.53 -0.53   -0.52 -0.52 -0.51 0.00
##              AUC_b  0.48  0.56    0.60   0.63  0.63    0.65  0.69  0.76 0.04
##            AUC_oob  0.41  0.54    0.59   0.63  0.63    0.66  0.72  0.82 0.05
##    sum_sens_spec_b  0.96  1.06    1.14   1.19  1.19    1.24  1.32  1.41 0.07
##  sum_sens_spec_oob  0.85  1.00    1.09   1.15  1.15    1.21  1.30  1.53 0.09
##              acc_b  0.39  0.50    0.54   0.58  0.58    0.63  0.68  0.76 0.06
##            acc_oob  0.37  0.46    0.52   0.57  0.57    0.61  0.67  0.73 0.06
##      sensitivity_b  0.30  0.46    0.54   0.62  0.63    0.71  0.81  0.90 0.11
##    sensitivity_oob  0.19  0.35    0.48   0.59  0.59    0.70  0.83  1.00 0.15
##      specificity_b  0.23  0.40    0.47   0.55  0.56    0.66  0.75  0.89 0.11
##    specificity_oob  0.20  0.36    0.46   0.55  0.56    0.65  0.76  0.86 0.12
##     cohens_kappa_b -0.03  0.05    0.11   0.16  0.16    0.20  0.27  0.40 0.07
##   cohens_kappa_oob -0.12  0.00    0.07   0.12  0.12    0.17  0.24  0.37 0.07
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
roc_K_AD <- cpK$roc_curve[[1]]
roc_K_MCI <- cpK_MCI$roc_curve[[1]]

write.csv(cpK$roc_curve[[1]], "datafig2a_rocAD.csv")
write.csv(cpK_MCI$roc_curve[[1]], "datafig2a_rocMCI.csv")

5.4.5.2 log Avg Thickness

cpT <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
       logAvgThickness,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.8492 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##            0.3882        1.4965 0.7333      0.7692      0.7273 20  6 42 112
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.3493389 0.3647104 0.3833783 0.3960273 0.3958050 0.4074788 0.4267862
##       AD 0.3493389 0.3567966 0.3626697 0.3771104 0.3758867 0.3868844 0.3954810
##      MCI        NA        NA        NA        NA       NaN        NA        NA
##      CTL 0.3566807 0.3720598 0.3863418 0.3992158 0.3991678 0.4094520 0.4280006
##       Max.         SD NAs
##  0.4411069 0.01856467   0
##  0.4034812 0.01439800   0
##         NA         NA   0
##  0.4411069 0.01704522   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.38 0.38    0.38   0.39 0.39    0.39 0.39 0.40 0.00   0
##              AUC_b  0.72 0.79    0.82   0.85 0.85    0.87 0.91 0.94 0.04   0
##            AUC_oob  0.65 0.76    0.82   0.85 0.85    0.88 0.92 0.99 0.05   0
##    sum_sens_spec_b  1.17 1.36    1.45   1.51 1.51    1.57 1.66 1.84 0.09   0
##  sum_sens_spec_oob  0.94 1.23    1.37   1.47 1.46    1.55 1.67 1.83 0.13   0
##              acc_b  0.59 0.64    0.69   0.74 0.74    0.79 0.86 0.94 0.07   0
##            acc_oob  0.52 0.62    0.68   0.73 0.73    0.78 0.83 0.92 0.07   0
##      sensitivity_b  0.52 0.64    0.73   0.77 0.77    0.83 0.90 1.00 0.08   0
##    sensitivity_oob  0.10 0.43    0.60   0.75 0.73    0.88 1.00 1.00 0.18   0
##      specificity_b  0.55 0.62    0.68   0.73 0.74    0.79 0.88 0.96 0.08   0
##    specificity_oob  0.47 0.58    0.66   0.72 0.73    0.80 0.89 0.98 0.09   0
##     cohens_kappa_b  0.09 0.19    0.27   0.33 0.34    0.40 0.53 0.73 0.10   0
##   cohens_kappa_oob -0.04 0.14    0.22   0.29 0.29    0.35 0.45 0.59 0.09   0
write.csv(cpT$data, "datafig2c_AD.csv")

cpT_MCI <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
       logAvgThickness,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT_MCI)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.6403 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            0.3978        1.1841 0.5694      0.6452       0.539 40 22 71 83
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.3516182 0.3687439 0.3850786 0.3971972 0.3966299 0.4074702 0.4259685
##       AD        NA        NA        NA        NA       NaN        NA        NA
##      MCI 0.3516182 0.3672800 0.3797841 0.3900228 0.3903262 0.4006382 0.4151921
##      CTL 0.3566807 0.3720598 0.3863418 0.3992158 0.3991678 0.4094520 0.4280006
##       Max.         SD NAs
##  0.4411069 0.01707448   0
##         NA         NA   0
##  0.4220982 0.01556185   0
##  0.4411069 0.01704522   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.38 0.39    0.39   0.40 0.40    0.40 0.40 0.41 0.00   0
##              AUC_b  0.50 0.57    0.62   0.64 0.64    0.67 0.71 0.78 0.04   0
##            AUC_oob  0.46 0.55    0.60   0.64 0.64    0.68 0.73 0.81 0.05   0
##    sum_sens_spec_b  0.94 1.08    1.15   1.20 1.20    1.26 1.33 1.43 0.08   0
##  sum_sens_spec_oob  0.90 1.01    1.10   1.16 1.16    1.23 1.32 1.48 0.10   0
##              acc_b  0.39 0.48    0.54   0.59 0.58    0.63 0.68 0.74 0.06   0
##            acc_oob  0.36 0.46    0.53   0.57 0.57    0.61 0.66 0.73 0.06   0
##      sensitivity_b  0.34 0.49    0.58   0.64 0.64    0.71 0.82 0.94 0.10   0
##    sensitivity_oob  0.15 0.38    0.52   0.61 0.61    0.71 0.86 1.00 0.15   0
##      specificity_b  0.19 0.36    0.49   0.57 0.56    0.64 0.74 0.84 0.11   0
##    specificity_oob  0.12 0.34    0.47   0.56 0.55    0.63 0.73 0.92 0.12   0
##     cohens_kappa_b -0.04 0.06    0.12   0.17 0.17    0.22 0.29 0.39 0.07   0
##   cohens_kappa_oob -0.08 0.00    0.08   0.13 0.13    0.19 0.27 0.40 0.08   0
write.csv(cpT_MCI$data, "datafig2c_MCI.csv")
roc_T_AD <- cpT$roc_curve[[1]]
roc_T_MCI <- cpT_MCI$roc_curve[[1]]

write.csv(cpT$roc_curve[[1]], "datafig2a_rocAD_T.csv")
write.csv(cpT_MCI$roc_curve[[1]], "datafig2a_rocMCI_T.csv")
lab1 = paste("AD: ACC=", signif(cpK$acc,2),"\nSENS=",signif(cpK$sensitivity,2),"\nSPEC=",signif(cpK$specificity,2),"\nMCI: ACC=", signif(cpK_MCI$acc,2),"\nSENS=",signif(cpK_MCI$sensitivity,2),"\nSPEC=",signif(cpK_MCI$specificity,2))

xrng1 <- range(dados_hemi_v1$K)

cutpoint_a <- ggplot(dados_hemi_v1, aes(x = K, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
    geom_density() +
    geom_vline(xintercept = cpK$optimal_cutpoint, linetype = "dashed") + 
    geom_vline(xintercept = cpK_MCI$optimal_cutpoint, linetype = "dotted") + 
    theme_pubr() +
    guides(alpha = "none") +
    labs(y = "Density") +
    theme(axis.title = element_text(size = 11),
          axis.text = element_text(size = 10), text = element_text(size = 10)) +
    scale_x_continuous(
        labels = scales::number_format(accuracy = 0.01), limits=c(-0.59,-0.46), breaks = c(-0.58, -0.55, -0.52, -0.49)) +
    scale_fill_manual(values=cbbPalette2) +
    scale_colour_manual(values=cbbPalette2)
# +
#     annotate("text", x = xrng1[1], y = Inf, vjust = 1.1, hjust = 0.95,label = lab1, size = 2)

lab2 = paste("AD: ACC=", signif(cpT$acc,2),"\nSENS=",signif(cpT$sensitivity,2),"\nSPEC=",signif(cpT$specificity,2),"\nMCI: ACC=", signif(cpT_MCI$acc,2),"\nSENS=",signif(cpT_MCI$sensitivity,2),"\nSPEC=",signif(cpT_MCI$specificity,2))

xrng2 <- range(dados_hemi_v1$logAvgThickness)

cutpoint_b <- ggplot(dados_hemi_v1, aes(x = logAvgThickness, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
    geom_density() +
    geom_vline(xintercept = cpT$optimal_cutpoint, linetype = "dashed") + 
    geom_vline(xintercept = cpT_MCI$optimal_cutpoint, linetype = "dotted") + 
    theme_pubr() +
    guides(alpha = "none") +
    theme(axis.title = element_text(size = 11),
          axis.text = element_text(size = 10), text = element_text(size = 10), legend.position = "none") +
    labs(x = expression('log'[10]*'T'), y = "Density") +
 scale_x_continuous(limits=c(0.32,0.48), n.breaks = 4) +
    scale_fill_manual(values=cbbPalette2) +
    scale_colour_manual(values=cbbPalette2)
# +
#     annotate("text", x = xrng2[1], y = Inf, vjust = 1.1, hjust = 0.95, label = lab2, size = 2)
# cutpoint_b

fig_cutpoint <- ggarrange(cutpoint_a, cutpoint_b, labels = c("A", "B"),  ncol = 1, font.label = list(size = 11), common.legend = TRUE, legend = "top")

5.4.5.3 GI

cpGI <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
       localGI,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI)
## Method: maximize_boot_metric 
## Predictor: localGI 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.7008 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##            2.5805        1.3741 0.6833      0.6923      0.6818 18  8 49 105
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.380713 2.491836 2.551500 2.612425 2.614738 2.674556 2.764586
##       AD 2.380713 2.401685 2.516433 2.554999 2.556980 2.610559 2.702224
##      MCI       NA       NA       NA       NA      NaN       NA       NA
##      CTL 2.419221 2.506121 2.561112 2.620543 2.624489 2.679626 2.773118
##      Max.         SD NAs
##  2.837762 0.08616113   0
##  2.713507 0.08880478   0
##        NA         NA   0
##  2.837762 0.08206137   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.49 2.55    2.57   2.58 2.58    2.59 2.61 2.67 0.02   0
##              AUC_b  0.49 0.60    0.66   0.70 0.70    0.74 0.79 0.88 0.06   0
##            AUC_oob  0.38 0.57    0.65   0.70 0.70    0.75 0.83 0.92 0.08   0
##    sum_sens_spec_b  0.77 1.14    1.28   1.35 1.35    1.42 1.51 1.62 0.11   0
##  sum_sens_spec_oob  0.83 1.06    1.21   1.31 1.30    1.40 1.54 1.76 0.15   0
##              acc_b  0.32 0.58    0.66   0.69 0.69    0.73 0.78 0.89 0.07   0
##            acc_oob  0.38 0.56    0.64   0.68 0.67    0.71 0.77 0.89 0.07   0
##      sensitivity_b  0.19 0.48    0.60   0.66 0.65    0.72 0.80 0.94 0.10   0
##    sensitivity_oob  0.00 0.33    0.50   0.62 0.62    0.75 0.88 1.00 0.17   0
##      specificity_b  0.26 0.56    0.65   0.70 0.69    0.74 0.80 0.99 0.08   0
##    specificity_oob  0.29 0.53    0.64   0.69 0.68    0.74 0.81 0.97 0.09   0
##     cohens_kappa_b -0.07 0.08    0.17   0.22 0.22    0.28 0.35 0.45 0.08   0
##   cohens_kappa_oob -0.12 0.04    0.13   0.19 0.19    0.25 0.33 0.48 0.09   0
cpGI_MCI <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
       localGI,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI_MCI)
## Method: maximize_boot_metric 
## Predictor: localGI 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5782 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            2.6258        1.1902 0.5463      0.7097      0.4805 44 18 80 74
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.419221 2.510932 2.558535 2.609695 2.618887 2.670658 2.765666
##       AD       NA       NA       NA       NA      NaN       NA       NA
##      MCI 2.507896 2.532143 2.558255 2.590824 2.604971 2.627853 2.741349
##      CTL 2.419221 2.506121 2.561112 2.620543 2.624489 2.679626 2.773118
##      Max.         SD NAs
##  2.837762 0.07787729   0
##        NA         NA   0
##  2.779485 0.06488261   0
##  2.837762 0.08206137   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.59 2.61    2.62   2.62 2.62    2.63 2.64 2.70 0.01   0
##              AUC_b  0.45 0.51    0.55   0.58 0.58    0.61 0.65 0.70 0.04   0
##            AUC_oob  0.38 0.49    0.54   0.58 0.58    0.62 0.67 0.76 0.06   0
##    sum_sens_spec_b  0.93 1.09    1.17   1.22 1.21    1.26 1.33 1.44 0.07   0
##  sum_sens_spec_oob  0.83 1.00    1.11   1.17 1.17    1.24 1.33 1.50 0.10   0
##              acc_b  0.29 0.48    0.53   0.56 0.56    0.59 0.63 0.69 0.05   0
##            acc_oob  0.39 0.46    0.51   0.54 0.54    0.57 0.62 0.68 0.05   0
##      sensitivity_b  0.44 0.59    0.68   0.73 0.72    0.77 0.83 0.91 0.07   0
##    sensitivity_oob  0.32 0.50    0.62   0.70 0.69    0.77 0.87 1.00 0.12   0
##      specificity_b  0.14 0.37    0.45   0.50 0.49    0.54 0.60 0.67 0.07   0
##    specificity_oob  0.21 0.35    0.43   0.48 0.48    0.53 0.60 0.77 0.08   0
##     cohens_kappa_b -0.04 0.06    0.13   0.17 0.17    0.21 0.26 0.37 0.06   0
##   cohens_kappa_oob -0.14 0.00    0.08   0.13 0.13    0.18 0.26 0.36 0.08   0

5.4.5.4 Deaged

5.4.5.4.1 K
cpK_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK_deaged)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.7852 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.5201        1.3696 0.7889      0.5385      0.8312 14 12 26 128
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5423463 -0.5317798 -0.5170820 -0.5061175 -0.5082363 -0.4987331
##       AD -0.5423463 -0.5397941 -0.5315661 -0.5261094 -0.5207321 -0.5064586
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.5324581 -0.5259456 -0.5149816 -0.5051845 -0.5061266 -0.4980014
##         95%       Max.         SD NAs
##  -0.4887326 -0.4795903 0.01320578   0
##  -0.5032434 -0.5026811 0.01356594   0
##          NA         NA         NA   0
##  -0.4878314 -0.4795903 0.01195587   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.53 -0.53   -0.52  -0.52 -0.52   -0.51 -0.51 -0.50 0.01
##              AUC_b  0.60  0.70    0.75   0.78  0.78    0.82  0.86  0.93 0.05
##            AUC_oob  0.48  0.67    0.74   0.79  0.79    0.84  0.90  1.00 0.07
##    sum_sens_spec_b  0.90  1.15    1.28   1.39  1.39    1.50  1.63  1.83 0.15
##  sum_sens_spec_oob  0.91  1.14    1.27   1.36  1.36    1.44  1.56  1.82 0.13
##              acc_b  0.42  0.56    0.68   0.78  0.76    0.85  0.91  0.96 0.11
##            acc_oob  0.42  0.54    0.68   0.78  0.75    0.83  0.89  0.95 0.11
##      sensitivity_b  0.36  0.48    0.54   0.59  0.60    0.65  0.76  1.00 0.09
##    sensitivity_oob  0.00  0.29    0.44   0.56  0.58    0.69  0.90  1.00 0.18
##      specificity_b  0.40  0.53    0.70   0.82  0.79    0.89  0.95  0.99 0.13
##    specificity_oob  0.36  0.49    0.69   0.81  0.78    0.90  0.96  1.00 0.14
##     cohens_kappa_b -0.05  0.08    0.17   0.30  0.32    0.46  0.62  0.79 0.18
##   cohens_kappa_oob -0.08  0.09    0.19   0.27  0.28    0.36  0.49  0.77 0.12
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
# plot(cpK)

write.csv(cpK_deaged$data, "datafig2b_AD.csv")


cpK_MCI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK_MCI_deaged)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5693 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##           -0.5082        1.1167 0.5694      0.5323      0.5844 33 29 64 90
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5385238 -0.5271938 -0.5157804 -0.5059702 -0.5070010 -0.4981933
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.5385238 -0.5290533 -0.5167194 -0.5104862 -0.5091730 -0.5004693
##      CTL -0.5324581 -0.5259456 -0.5149816 -0.5051845 -0.5061266 -0.4980014
##         95%       Max.         SD NAs
##  -0.4885254 -0.4795903 0.01218702   0
##          NA         NA         NA   0
##  -0.4890858 -0.4849284 0.01257898   0
##  -0.4878314 -0.4795903 0.01195587   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.52 -0.52   -0.51  -0.51 -0.51   -0.51 -0.50 -0.50 0.00
##              AUC_b  0.43  0.49    0.54   0.57  0.57    0.60  0.64  0.70 0.04
##            AUC_oob  0.41  0.48    0.53   0.57  0.57    0.61  0.67  0.76 0.06
##    sum_sens_spec_b  0.89  1.01    1.08   1.14  1.14    1.20  1.29  1.42 0.09
##  sum_sens_spec_oob  0.81  0.94    1.04   1.11  1.11    1.18  1.27  1.40 0.10
##              acc_b  0.36  0.50    0.56   0.59  0.59    0.63  0.68  0.74 0.05
##            acc_oob  0.37  0.47    0.54   0.58  0.58    0.62  0.67  0.75 0.06
##      sensitivity_b  0.13  0.31    0.46   0.53  0.52    0.59  0.71  0.85 0.11
##    sensitivity_oob  0.09  0.27    0.43   0.50  0.50    0.59  0.71  0.86 0.13
##      specificity_b  0.21  0.45    0.55   0.63  0.62    0.69  0.77  0.94 0.10
##    specificity_oob  0.23  0.42    0.54   0.62  0.61    0.69  0.78  0.89 0.11
##     cohens_kappa_b -0.10  0.01    0.07   0.13  0.13    0.17  0.26  0.39 0.08
##   cohens_kappa_oob -0.17 -0.05    0.03   0.10  0.10    0.16  0.24  0.39 0.09
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
# plot(cpK_MCI)


write.csv(cpK_MCI_deaged$data, "datafig2b_MCI.csv")
5.4.5.4.2 log Avg Thickness
cpT_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
       logAvgThickness_age_decay,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT_deaged)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.7248 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##             0.423        1.2727 0.7333         0.5      0.7727 13 13 35 119
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.3915353 0.4087752 0.4227995 0.4301048 0.4318351 0.4421783 0.4588600
##       AD 0.3915353 0.4010329 0.4116461 0.4226828 0.4214529 0.4291104 0.4418508
##      MCI        NA        NA        NA        NA       NaN        NA        NA
##      CTL 0.4001589 0.4134574 0.4238657 0.4314060 0.4335880 0.4435058 0.4590177
##       Max.         SD NAs
##  0.4628195 0.01460961   0
##  0.4468100 0.01378867   0
##         NA         NA   0
##  0.4628195 0.01404404   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.41 0.42    0.42   0.42 0.42    0.43 0.43 0.44 0.00   0
##              AUC_b  0.48 0.63    0.69   0.73 0.73    0.76 0.81 0.88 0.06   0
##            AUC_oob  0.45 0.59    0.67   0.72 0.72    0.77 0.85 0.93 0.08   0
##    sum_sens_spec_b  0.93 1.15    1.28   1.35 1.34    1.41 1.52 1.63 0.11   0
##  sum_sens_spec_oob  0.83 1.02    1.17   1.27 1.26    1.36 1.51 1.74 0.14   0
##              acc_b  0.32 0.55    0.66   0.72 0.71    0.78 0.84 0.92 0.09   0
##            acc_oob  0.31 0.54    0.64   0.71 0.70    0.76 0.82 0.90 0.09   0
##      sensitivity_b  0.32 0.44    0.54   0.61 0.61    0.68 0.79 0.94 0.11   0
##    sensitivity_oob  0.00 0.22    0.40   0.54 0.54    0.69 0.89 1.00 0.20   0
##      specificity_b  0.28 0.52    0.66   0.74 0.73    0.82 0.89 0.95 0.11   0
##    specificity_oob  0.22 0.50    0.65   0.73 0.72    0.82 0.89 0.96 0.12   0
##     cohens_kappa_b -0.03 0.08    0.17   0.24 0.24    0.30 0.41 0.60 0.10   0
##   cohens_kappa_oob -0.15 0.01    0.11   0.17 0.18    0.24 0.35 0.56 0.10   0
write.csv(cpT_deaged$data, "datafig2d_AD.csv")

cpT_MCI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
       logAvgThickness_age_decay,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT_MCI_deaged)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5538 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            0.4345        1.0157 0.4769      0.5806      0.4351 36 26 87 67
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.4001589 0.4122778 0.4229958 0.4308261 0.4327482 0.4431223 0.4573704
##       AD        NA        NA        NA        NA       NaN        NA        NA
##      MCI 0.4024658 0.4095831 0.4206394 0.4292656 0.4306624 0.4413764 0.4493808
##      CTL 0.4001589 0.4134574 0.4238657 0.4314060 0.4335880 0.4435058 0.4590177
##       Max.         SD NAs
##  0.4628195 0.01370884   0
##         NA         NA   0
##  0.4557856 0.01270739   0
##  0.4628195 0.01404404   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.42  0.42    0.43   0.43 0.43    0.44 0.45 0.45 0.01   0
##              AUC_b  0.40  0.48    0.53   0.56 0.56    0.59 0.63 0.68 0.05   0
##            AUC_oob  0.38  0.45    0.51   0.55 0.55    0.59 0.65 0.76 0.06   0
##    sum_sens_spec_b  0.75  0.92    1.01   1.08 1.08    1.15 1.24 1.33 0.10   0
##  sum_sens_spec_oob  0.70  0.87    0.96   1.03 1.02    1.09 1.18 1.32 0.10   0
##              acc_b  0.31  0.38    0.43   0.50 0.51    0.59 0.67 0.74 0.10   0
##            acc_oob  0.27  0.36    0.42   0.49 0.49    0.56 0.62 0.69 0.08   0
##      sensitivity_b  0.31  0.43    0.51   0.57 0.60    0.68 0.88 1.00 0.13   0
##    sensitivity_oob  0.10  0.28    0.43   0.55 0.57    0.71 0.91 1.00 0.19   0
##      specificity_b  0.09  0.21    0.32   0.47 0.47    0.62 0.75 0.91 0.17   0
##    specificity_oob  0.05  0.18    0.31   0.46 0.46    0.61 0.72 0.85 0.17   0
##     cohens_kappa_b -0.19 -0.06    0.00   0.06 0.07    0.12 0.23 0.35 0.09   0
##   cohens_kappa_oob -0.24 -0.11   -0.03   0.02 0.02    0.07 0.15 0.29 0.08   0
write.csv(cpT_MCI_deaged$data, "datafig2d_MCI.csv")
5.4.5.4.3 GI
cpGI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
        localGI_age_decay,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI_deaged)
## Method: maximize_boot_metric 
## Predictor: localGI_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.6476 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            2.6673        1.2577 0.6111      0.6538      0.6039 17  9 61 93
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.511402 2.577661 2.633063 2.681774 2.687612 2.738753 2.807036
##       AD 2.515421 2.519055 2.620142 2.654242 2.651294 2.693528 2.772357
##      MCI       NA       NA       NA       NA      NaN       NA       NA
##      CTL 2.511402 2.591092 2.637065 2.692298 2.693743 2.740771 2.822236
##      Max.         SD NAs
##  2.872972 0.07434917   0
##  2.778640 0.07489024   0
##        NA         NA   0
##  2.872972 0.07272383   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.60  2.63    2.66   2.67 2.67    2.68 2.70 2.75 0.02   0
##              AUC_b  0.42  0.55    0.61   0.65 0.65    0.69 0.74 0.84 0.06   0
##            AUC_oob  0.27  0.51    0.59   0.65 0.65    0.71 0.78 0.92 0.08   0
##    sum_sens_spec_b  0.86  1.05    1.17   1.23 1.24    1.31 1.43 1.64 0.11   0
##  sum_sens_spec_oob  0.60  0.93    1.09   1.19 1.19    1.29 1.43 1.73 0.15   0
##              acc_b  0.23  0.47    0.57   0.63 0.62    0.67 0.74 0.85 0.09   0
##            acc_oob  0.32  0.46    0.55   0.61 0.60    0.66 0.74 0.84 0.08   0
##      sensitivity_b  0.23  0.38    0.55   0.64 0.62    0.70 0.79 0.91 0.13   0
##    sensitivity_oob  0.00  0.20    0.44   0.60 0.58    0.73 0.88 1.00 0.21   0
##      specificity_b  0.17  0.44    0.55   0.62 0.62    0.69 0.79 0.95 0.11   0
##    specificity_oob  0.20  0.42    0.54   0.61 0.61    0.68 0.80 0.94 0.12   0
##     cohens_kappa_b -0.06  0.03    0.09   0.13 0.14    0.18 0.26 0.41 0.07   0
##   cohens_kappa_oob -0.21 -0.04    0.05   0.10 0.10    0.16 0.24 0.38 0.09   0
# plot(cpK)

cpGI_MCI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
        localGI_age_decay,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI_MCI_deaged)
## Method: maximize_boot_metric 
## Predictor: localGI_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5334 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            2.7054        1.1736 0.5139      0.7581      0.4156 47 15 90 64
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.511402 2.598801 2.642303 2.685176 2.691592 2.735631 2.812225
##       AD       NA       NA       NA       NA      NaN       NA       NA
##      MCI 2.595836 2.609992 2.645187 2.673114 2.686248 2.702904 2.807338
##      CTL 2.511402 2.591092 2.637065 2.692298 2.693743 2.740771 2.822236
##      Max.         SD NAs
##  2.872972 0.06892145   0
##        NA         NA   0
##  2.835621 0.05862119   0
##  2.872972 0.07272383   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.66  2.69    2.70   2.70 2.71    2.71 2.73 2.79 0.01   0
##              AUC_b  0.39  0.47    0.50   0.53 0.53    0.56 0.60 0.67 0.04   0
##            AUC_oob  0.35  0.44    0.50   0.53 0.53    0.57 0.62 0.70 0.06   0
##    sum_sens_spec_b  0.88  1.01    1.10   1.16 1.15    1.22 1.29 1.39 0.09   0
##  sum_sens_spec_oob  0.77  0.95    1.07   1.13 1.12    1.19 1.27 1.40 0.10   0
##              acc_b  0.28  0.40    0.48   0.52 0.51    0.55 0.59 0.65 0.06   0
##            acc_oob  0.35  0.42    0.47   0.49 0.50    0.53 0.58 0.63 0.05   0
##      sensitivity_b  0.46  0.60    0.69   0.74 0.73    0.78 0.84 0.90 0.07   0
##    sensitivity_oob  0.17  0.50    0.63   0.72 0.71    0.80 0.89 1.00 0.12   0
##      specificity_b  0.12  0.27    0.38   0.43 0.42    0.48 0.55 0.70 0.09   0
##    specificity_oob  0.14  0.28    0.36   0.41 0.41    0.46 0.54 0.70 0.08   0
##     cohens_kappa_b -0.08  0.00    0.07   0.12 0.12    0.16 0.22 0.31 0.07   0
##   cohens_kappa_oob -0.22 -0.04    0.05   0.09 0.09    0.14 0.20 0.30 0.07   0
# plot(cpK_MCI)
lab3 = paste("AD: ACC=", signif(cpK_deaged$acc,2),"\nSENS=",signif(cpK_deaged$sensitivity,2),"\nSPEC=",signif(cpK_deaged$specificity,2),"\nMCI: ACC=", signif(cpK_MCI_deaged$acc,2),"\nSENS=",signif(cpK_MCI_deaged$sensitivity,2),"\nSPEC=",signif(cpK_MCI_deaged$specificity,2))

cutpoint_a_deaged <- ggplot(dados_hemi_v1, aes(x = K_age_decay, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
  geom_density() +
  geom_vline(data = cpK_deaged, aes(xintercept = optimal_cutpoint), linetype = "dashed") + 
    geom_vline(data = cpK_MCI_deaged, aes(xintercept = optimal_cutpoint), linetype = "dotted") + 
  theme_pubr() +
  guides(alpha = "none", linetype = "none") +
  theme(axis.title = element_text(size = 11),
    axis.text = element_text(size = 10), text = element_text(size = 10)) +
  labs(x = "K (After age correction)", y = "Density") +
  scale_x_continuous(
              labels = scales::number_format(accuracy = 0.01), limits=c(-0.59,-0.46), breaks = c(-0.58, -0.55, -0.52, -0.49)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
# +
#     annotate("text", x = xrng1[1], y = Inf, vjust = 1.1, hjust = 0.95, label = lab3, size = 2)
# cutpoint_a_deaged

lab4 = paste("AD: ACC=", signif(cpT_deaged$acc,2),"\nSENS=",signif(cpT_deaged$sensitivity,2),"\nSPEC=",signif(cpT_deaged$specificity,2),"\nMCI: ACC=", signif(cpT_MCI_deaged$acc,2),"\nSENS=",signif(cpT_MCI_deaged$sensitivity,2),"\nSPEC=",signif(cpT_MCI_deaged$specificity,2))

cutpoint_b_deaged <- ggplot(dados_hemi_v1, aes(x = logAvgThickness_age_decay, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
  geom_density() +
  geom_vline(data = cpT_deaged, aes(xintercept = optimal_cutpoint), linetype = "dashed") + 
  geom_vline(data = cpT_MCI_deaged, aes(xintercept = optimal_cutpoint), linetype = "dotted") + 
  theme_pubr() +
  guides(alpha = "none", linetype = "none") +
  theme(axis.title = element_text(size = 11),
    axis.text = element_text(size = 10), text = element_text(size = 10), legend.position = "none") +
  labs(x = expression('log'[10]*'T '*('After age correction')), y = "Density") +
  scale_x_continuous(limits=c(0.32,0.48), n.breaks = 4) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
# +
# annotate("text", x = xrng2[1], y = Inf, vjust = 1.1, hjust = 0.95, label = lab4, size = 2)

5.4.6 data sharing - FIGURE 2

datafig2 <- dados_hemi_v1 %>%
  dplyr::select(c(Age, Diagnostic, AvgThickness, TotalArea, ExposedArea, K)) %>%
  mutate(x = log10(ExposedArea),
         y = log10(sqrt(AvgThickness) * TotalArea)) %>%
  dplyr::select(c(Age, Diagnostic, x, y, K))
write.csv(datafig1, "datafig1.csv")

FIGURE 2

fig_cutpoint_deaged_alt <- ggarrange(cutpoint_a, cutpoint_b, cutpoint_a_deaged,  cutpoint_b_deaged, labels = c("A", "B", "C", "D"),  ncol = 2, nrow = 2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom") + 
  theme(plot.background = element_rect(fill="white", color = NA))

ggsave("Figure2_nocomments.png", plot = fig_cutpoint_deaged_alt, width = 18, height = 11, units = "cm", device = "png")
ggsave("Figure2_nocomments.pdf", plot = fig_cutpoint_deaged_alt, width = 18, height = 11, units = "cm", device = "pdf")

# ggsave("fig_cutpoint_deaged_alt.pdf", plot = fig_cutpoint_deaged_alt, dpi=1200, width = 9, height = 22, units = "cm", device = "pdf")
fig_cutpoint_deaged_alt
\label{fig:figure2}Optimal cut-off (maximum sensitivity + specificity) for K and Average Cortical Thickness including results with removed age effect (age correction). AD in red (N = 13), MCI in green (N = 33), and Cognitive Unimpaired Controls (CTL) in blue (N = 77). The dashed line represents optimal cut-off to discriminate AD and CTL, and the dotted line represents optimal cut-off to discriminate MCI and CTL. ACC - accuracy, SPEC - specificity, and SENS - sensibility. (A) The optimal cut-off for the CTL-AD contrast is -0.54 and CTL-MCI, -0.53. (B) The optimal cut-off for CTL-AD = -0.52 and CTL-MCI = -0.51. (C) The optimal cut-off for CTL-AD = 0.39 mm and CTL-MCI = 0.40 mm. (D) The optimal cut-off for CTL-AD = 0.43 mm and CTL-MCI = 0.44 mm.

Optimal cut-off (maximum sensitivity + specificity) for K and Average Cortical Thickness including results with removed age effect (age correction). AD in red (N = 13), MCI in green (N = 33), and Cognitive Unimpaired Controls (CTL) in blue (N = 77). The dashed line represents optimal cut-off to discriminate AD and CTL, and the dotted line represents optimal cut-off to discriminate MCI and CTL. ACC - accuracy, SPEC - specificity, and SENS - sensibility. (A) The optimal cut-off for the CTL-AD contrast is -0.54 and CTL-MCI, -0.53. (B) The optimal cut-off for CTL-AD = -0.52 and CTL-MCI = -0.51. (C) The optimal cut-off for CTL-AD = 0.39 mm and CTL-MCI = 0.40 mm. (D) The optimal cut-off for CTL-AD = 0.43 mm and CTL-MCI = 0.44 mm.

5.4.6.1 Lobes (age corrected)

Table 1

cpK <-
    cutpointr(
        filter(dados_lobos_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        ROI,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Subgroups: F, P, T, O 
## Nr. of bootstraps: 1000 
## 
## Subgroup: F 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.6994 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.4614         1.243 0.7345      0.4615      0.7815 12 14 33 118
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.4924472 -0.4777872 -0.4618779 -0.4493759 -0.4504447 -0.4382565
##       AD -0.4924472 -0.4858975 -0.4771550 -0.4608831 -0.4613222 -0.4447041
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.4889670 -0.4736635 -0.4585019 -0.4487091 -0.4485717 -0.4360336
##         95%       Max.         SD NAs
##  -0.4272281 -0.4191747 0.01623795   0
##  -0.4359569 -0.4332498 0.01813598   0
##          NA         NA         NA   0
##  -0.4264298 -0.4191747 0.01518272   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.48 -0.47   -0.47  -0.46 -0.46   -0.46 -0.45 -0.43 0.01
##              AUC_b  0.46  0.60    0.66   0.70  0.70    0.74  0.79  0.88 0.06
##            AUC_oob  0.44  0.56    0.65   0.70  0.70    0.76  0.83  0.99 0.08
##    sum_sens_spec_b  0.73  1.11    1.22   1.30  1.29    1.37  1.48  1.64 0.12
##  sum_sens_spec_oob  0.83  1.02    1.15   1.24  1.24    1.33  1.46  1.89 0.14
##              acc_b  0.31  0.55    0.70   0.75  0.74    0.79  0.86  0.94 0.09
##            acc_oob  0.34  0.55    0.68   0.74  0.72    0.78  0.84  0.94 0.09
##      sensitivity_b  0.25  0.37    0.44   0.52  0.52    0.59  0.70  1.00 0.10
##    sensitivity_oob  0.00  0.20    0.36   0.45  0.48    0.60  0.80  1.00 0.18
##      specificity_b  0.25  0.54    0.73   0.79  0.77    0.84  0.92  0.99 0.11
##    specificity_oob  0.15  0.51    0.71   0.79  0.76    0.84  0.93  1.00 0.12
##     cohens_kappa_b -0.10  0.06    0.15   0.23  0.23    0.30  0.44  0.68 0.11
##   cohens_kappa_oob -0.13  0.01    0.11   0.18  0.18    0.25  0.36  0.61 0.11
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: P 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.7858 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##            -0.337        1.4845 0.7232      0.7692      0.7152 20  6 43 108
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3887231 -0.3609292 -0.3417547 -0.3303306 -0.3324749 -0.3209917
##       AD -0.3673445 -0.3645357 -0.3577182 -0.3451577 -0.3459457 -0.3386622
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.3887231 -0.3595692 -0.3382488 -0.3285399 -0.3301554 -0.3194001
##         95%       Max.         SD NAs
##  -0.3093390 -0.2967149 0.01692941   0
##  -0.3260820 -0.3201238 0.01326828   0
##          NA         NA         NA   0
##  -0.3082498 -0.2967149 0.01643388   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.35 -0.34   -0.34  -0.34 -0.34   -0.34 -0.33 -0.33 0.00
##              AUC_b  0.62  0.71    0.76   0.79  0.78    0.81  0.85  0.90 0.04
##            AUC_oob  0.54  0.69    0.75   0.79  0.79    0.83  0.89  0.96 0.06
##    sum_sens_spec_b  1.12  1.30    1.40   1.47  1.47    1.54  1.64  1.77 0.10
##  sum_sens_spec_oob  0.87  1.19    1.35   1.45  1.44    1.54  1.65  1.82 0.14
##              acc_b  0.47  0.63    0.69   0.73  0.73    0.77  0.81  0.89 0.06
##            acc_oob  0.49  0.61    0.68   0.72  0.72    0.76  0.81  0.87 0.06
##      sensitivity_b  0.41  0.59    0.69   0.75  0.74    0.81  0.88  0.96 0.09
##    sensitivity_oob  0.11  0.40    0.62   0.75  0.72    0.83  1.00  1.00 0.17
##      specificity_b  0.41  0.61    0.68   0.73  0.72    0.77  0.82  0.94 0.07
##    specificity_oob  0.38  0.58    0.67   0.72  0.72    0.77  0.84  0.94 0.08
##     cohens_kappa_b  0.06  0.16    0.25   0.30  0.31    0.37  0.45  0.59 0.09
##   cohens_kappa_oob -0.11  0.12    0.21   0.27  0.27    0.34  0.43  0.56 0.10
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: T 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.7504 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.3421        1.2975 0.6723      0.6154      0.6821 16 10 48 103
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3862226 -0.3693890 -0.3449413 -0.3362110 -0.3372773 -0.3269770
##       AD -0.3862226 -0.3793668 -0.3651671 -0.3476139 -0.3513326 -0.3366410
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.3723159 -0.3605893 -0.3441472 -0.3347947 -0.3348572 -0.3258725
##         95%       Max.         SD NAs
##  -0.3115348 -0.2980570 0.01646089   0
##  -0.3310313 -0.3219632 0.01803107   0
##          NA         NA         NA   0
##  -0.3109501 -0.2980570 0.01495334   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.37 -0.35   -0.35  -0.34 -0.34   -0.34 -0.33 -0.33 0.01
##              AUC_b  0.58  0.66    0.72   0.75  0.75    0.78  0.82  0.90 0.05
##            AUC_oob  0.42  0.64    0.70   0.76  0.75    0.80  0.87  0.99 0.07
##    sum_sens_spec_b  1.01  1.18    1.27   1.34  1.34    1.42  1.51  1.68 0.10
##  sum_sens_spec_oob  0.60  1.04    1.19   1.29  1.28    1.38  1.52  1.88 0.15
##              acc_b  0.40  0.54    0.63   0.69  0.70    0.77  0.84  0.93 0.09
##            acc_oob  0.39  0.51    0.61   0.68  0.68    0.75  0.82  0.90 0.10
##      sensitivity_b  0.31  0.44    0.56   0.64  0.64    0.71  0.83  0.94 0.11
##    sensitivity_oob  0.00  0.25    0.44   0.60  0.59    0.75  0.91  1.00 0.21
##      specificity_b  0.34  0.50    0.62   0.70  0.71    0.81  0.88  0.99 0.12
##    specificity_oob  0.30  0.46    0.60   0.70  0.69    0.80  0.89  1.00 0.14
##     cohens_kappa_b  0.01  0.09    0.16   0.22  0.23    0.30  0.40  0.60 0.10
##   cohens_kappa_oob -0.14  0.03    0.12   0.17  0.18    0.25  0.35  0.64 0.10
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: O 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.6694 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.3545        1.2682 0.7288         0.5      0.7682 13 13 35 116
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.4071304 -0.3816251 -0.3556343 -0.3413318 -0.3412010 -0.3271589
##       AD -0.4071304 -0.3888987 -0.3758057 -0.3538700 -0.3547200 -0.3347385
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.3914546 -0.3758727 -0.3531679 -0.3392267 -0.3388732 -0.3262021
##         95%       Max.         SD NAs
##  -0.2999387 -0.2784499 0.02333062   0
##  -0.3130321 -0.3074425 0.02669722   0
##          NA         NA         NA   0
##  -0.2976979 -0.2784499 0.02197141   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.38 -0.37   -0.36  -0.35 -0.35   -0.35 -0.35 -0.33 0.01
##              AUC_b  0.41  0.56    0.62   0.67  0.67    0.71  0.77  0.89 0.07
##            AUC_oob  0.17  0.52    0.61   0.67  0.67    0.73  0.82  0.92 0.09
##    sum_sens_spec_b  0.93  1.12    1.22   1.29  1.29    1.36  1.45  1.71 0.11
##  sum_sens_spec_oob  0.60  1.00    1.13   1.23  1.23    1.32  1.47  1.64 0.15
##              acc_b  0.36  0.63    0.69   0.73  0.73    0.78  0.84  0.93 0.07
##            acc_oob  0.36  0.59    0.67   0.72  0.72    0.77  0.83  0.90 0.08
##      sensitivity_b  0.16  0.32    0.43   0.52  0.52    0.60  0.74  0.90 0.12
##    sensitivity_oob  0.00  0.19    0.33   0.45  0.47    0.60  0.78  0.93 0.18
##      specificity_b  0.31  0.62    0.71   0.77  0.77    0.83  0.91  0.98 0.09
##    specificity_oob  0.24  0.59    0.69   0.76  0.76    0.84  0.92  0.98 0.10
##     cohens_kappa_b -0.02  0.08    0.16   0.21  0.22    0.27  0.38  0.63 0.09
##   cohens_kappa_oob -0.15  0.00    0.09   0.17  0.17    0.24  0.35  0.49 0.11
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
cpK_MCI <-
    cutpointr(
        filter(dados_lobos_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        ROI,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK_MCI)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Subgroups: F, P, T, O 
## Nr. of bootstraps: 1000 
## 
## Subgroup: F 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.5522 212    61   151
## 
##  optimal_cutpoint sum_sens_spec acc sensitivity specificity tp fn fp tn
##           -0.4471        1.0244 0.5       0.541      0.4834 33 28 78 73
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.4889670 -0.4757844 -0.4598181 -0.4485104 -0.4493672 -0.4381553
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.4830813 -0.4761787 -0.4617166 -0.4482128 -0.4513364 -0.4403851
##      CTL -0.4889670 -0.4736635 -0.4585019 -0.4487091 -0.4485717 -0.4360336
##         95%       Max.         SD NAs
##  -0.4271525 -0.4173079 0.01534275   0
##          NA         NA         NA   0
##  -0.4274757 -0.4173079 0.01568441   0
##  -0.4264298 -0.4191747 0.01518272   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.47 -0.46   -0.45  -0.45 -0.45   -0.44 -0.44 -0.43 0.01
##              AUC_b  0.41  0.48    0.52   0.56  0.55    0.58  0.63  0.69 0.04
##            AUC_oob  0.35  0.45    0.51   0.55  0.55    0.59  0.64  0.73 0.06
##    sum_sens_spec_b  0.82  0.94    1.03   1.08  1.08    1.14  1.21  1.33 0.08
##  sum_sens_spec_oob  0.64  0.85    0.96   1.03  1.03    1.10  1.19  1.33 0.10
##              acc_b  0.37  0.43    0.49   0.53  0.54    0.59  0.67  0.73 0.07
##            acc_oob  0.30  0.40    0.46   0.51  0.52    0.58  0.65  0.77 0.08
##      sensitivity_b  0.15  0.29    0.44   0.53  0.54    0.65  0.81  0.95 0.15
##    sensitivity_oob  0.00  0.20    0.38   0.50  0.50    0.63  0.80  1.00 0.18
##      specificity_b  0.16  0.31    0.43   0.52  0.54    0.65  0.79  0.92 0.15
##    specificity_oob  0.16  0.27    0.40   0.52  0.52    0.64  0.81  0.95 0.16
##     cohens_kappa_b -0.17 -0.05    0.02   0.06  0.07    0.11  0.19  0.31 0.07
##   cohens_kappa_oob -0.27 -0.12   -0.03   0.02  0.02    0.08  0.16  0.35 0.09
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: P 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.4668 212    61   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##             -0.34        1.0699 0.6368      0.2951      0.7748 18 43 34 117
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3887231 -0.3603217 -0.3398804 -0.3280799 -0.3297166 -0.3177028
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.3733775 -0.3612115 -0.3437751 -0.3234164 -0.3286303 -0.3134190
##      CTL -0.3887231 -0.3595692 -0.3382488 -0.3285399 -0.3301554 -0.3194001
##         95%       Max.         SD NAs
##  -0.3063437 -0.2866583 0.01747905   0
##          NA         NA         NA   0
##  -0.3031533 -0.2866583 0.01993832   0
##  -0.3082498 -0.2967149 0.01643388   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.36 -0.35   -0.34  -0.34 -0.34   -0.34 -0.33 -0.31 0.01
##              AUC_b  0.31  0.39    0.44   0.47  0.47    0.50  0.55  0.63 0.05
##            AUC_oob  0.23  0.36    0.42   0.46  0.46    0.50  0.57  0.68 0.06
##    sum_sens_spec_b  0.75  0.95    1.04   1.09  1.08    1.13  1.20  1.32 0.08
##  sum_sens_spec_oob  0.79  0.91    0.98   1.04  1.04    1.09  1.17  1.31 0.08
##              acc_b  0.24  0.55    0.62   0.66  0.65    0.68  0.72  0.79 0.06
##            acc_oob  0.28  0.54    0.59   0.63  0.63    0.66  0.71  0.78 0.06
##      sensitivity_b  0.08  0.16    0.24   0.30  0.29    0.35  0.42  0.83 0.08
##    sensitivity_oob  0.00  0.10    0.19   0.25  0.26    0.32  0.45  1.00 0.11
##      specificity_b  0.04  0.64    0.76   0.80  0.79    0.84  0.90  0.95 0.10
##    specificity_oob  0.06  0.63    0.74   0.79  0.78    0.84  0.91  1.00 0.10
##     cohens_kappa_b -0.21 -0.05    0.04   0.09  0.09    0.14  0.21  0.33 0.08
##   cohens_kappa_oob -0.22 -0.09   -0.02   0.04  0.04    0.10  0.18  0.29 0.09
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: T 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.5924 212    61   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.3451        1.2112 0.6887      0.4098      0.8013 25 36 30 121
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3801095 -0.3613212 -0.3454849 -0.3362370 -0.3364610 -0.3261235
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.3801095 -0.3672974 -0.3544182 -0.3409346 -0.3404312 -0.3261432
##      CTL -0.3723159 -0.3605893 -0.3441472 -0.3347947 -0.3348572 -0.3258725
##         95%       Max.         SD NAs
##  -0.3110041 -0.2980570 0.01578222   0
##          NA         NA         NA   0
##  -0.3126286 -0.3066956 0.01715873   0
##  -0.3109501 -0.2980570 0.01495334   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.36 -0.35   -0.35  -0.34 -0.34   -0.34 -0.34 -0.33 0.00
##              AUC_b  0.43  0.51    0.56   0.59  0.59    0.63  0.67  0.73 0.05
##            AUC_oob  0.37  0.49    0.55   0.59  0.59    0.63  0.70  0.77 0.06
##    sum_sens_spec_b  0.85  1.07    1.15   1.20  1.20    1.25  1.32  1.47 0.08
##  sum_sens_spec_oob  0.85  0.99    1.08   1.15  1.15    1.22  1.32  1.51 0.10
##              acc_b  0.43  0.58    0.64   0.67  0.67    0.70  0.75  0.80 0.05
##            acc_oob  0.44  0.55    0.61   0.65  0.65    0.69  0.74  0.80 0.06
##      sensitivity_b  0.23  0.29    0.37   0.43  0.44    0.50  0.59  0.71 0.09
##    sensitivity_oob  0.00  0.21    0.32   0.40  0.40    0.48  0.62  0.92 0.12
##      specificity_b  0.39  0.61    0.70   0.77  0.76    0.83  0.88  0.92 0.09
##    specificity_oob  0.26  0.56    0.67   0.76  0.74    0.83  0.88  0.96 0.10
##     cohens_kappa_b -0.11  0.07    0.14   0.19  0.19    0.25  0.33  0.47 0.08
##   cohens_kappa_oob -0.15 -0.01    0.08   0.15  0.15    0.21  0.31  0.48 0.10
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: O 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.5638 212    61   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn  fp tn
##           -0.3309        1.1048 0.4528      0.7869      0.3179 48 13 103 48
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3914546 -0.3737928 -0.3526654 -0.3404060 -0.3401463 -0.3291942
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.3738751 -0.3665170 -0.3516385 -0.3446323 -0.3432977 -0.3340610
##      CTL -0.3914546 -0.3758727 -0.3531679 -0.3392267 -0.3388732 -0.3262021
##         95%       Max.         SD NAs
##  -0.3067105 -0.2784499 0.02028267   0
##          NA         NA         NA   0
##  -0.3155374 -0.3085133 0.01502257   0
##  -0.2976979 -0.2784499 0.02197141   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.35 -0.34   -0.34  -0.33 -0.33   -0.33 -0.33 -0.31 0.01
##              AUC_b  0.41  0.50    0.54   0.56  0.56    0.59  0.63  0.69 0.04
##            AUC_oob  0.41  0.47    0.53   0.57  0.56    0.60  0.65  0.73 0.05
##    sum_sens_spec_b  0.95  1.03    1.10   1.14  1.15    1.19  1.27  1.39 0.07
##  sum_sens_spec_oob  0.81  0.94    1.03   1.10  1.09    1.15  1.24  1.37 0.09
##              acc_b  0.33  0.41    0.46   0.50  0.50    0.55  0.61  0.69 0.06
##            acc_oob  0.31  0.39    0.44   0.48  0.48    0.52  0.58  0.66 0.06
##      sensitivity_b  0.45  0.58    0.67   0.74  0.74    0.80  0.88  0.98 0.09
##    sensitivity_oob  0.25  0.44    0.59   0.71  0.70    0.81  0.91  1.00 0.15
##      specificity_b  0.11  0.24    0.32   0.40  0.41    0.50  0.60  0.70 0.11
##    specificity_oob  0.08  0.21    0.30   0.38  0.39    0.48  0.59  0.67 0.12
##     cohens_kappa_b -0.03  0.02    0.07   0.10  0.11    0.15  0.22  0.35 0.06
##   cohens_kappa_oob -0.16 -0.05    0.02   0.07  0.07    0.11  0.18  0.29 0.07
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0

5.4.7 Aging and pathological morphology alterations

Age groups:

dados_hemi_v1_agegroups <- dados_hemi_v1 %>%
  mutate(Age.group = ifelse(
    Age > 75,
    "76-86",
    ifelse((Age < 75 | Age == 75 & Age > 65 | Age == 65),
           "66-75",
           "")))
Diagnostic Age.group N age age_range ESC
AD 66-75 4 69 ± 3.5 63 ; 71 12 ± 2.7
AD 76-86 9 81 ± 2.3 78 ; 86 13 ± 3.2
MCI 66-75 22 70 ± 3 62 ; 74 13 ± 2.5
MCI 76-86 9 78 ± 2.5 75 ; 82 13 ± 2.1
CTL 66-75 67 64 ± 7.7 43 ; 74 15 ± 2
CTL 76-86 10 77 ± 1.4 75 ; 80 14 ± 2.6

5.4.7.1 K

summary(aov(K ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##                       Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic             2 0.01123 0.005617  29.179 4.75e-12 ***
## Age.group              1 0.00145 0.001453   7.550  0.00646 ** 
## Diagnostic:Age.group   2 0.00021 0.000103   0.535  0.58615    
## Residuals            236 0.04543 0.000193                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(K ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic * Age.group, data = dados_hemi_v1_agegroups)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007867813 0.02315970 0.0000090
## CTL-AD  0.021969964 0.015031528 0.02890840 0.0000000
## CTL-MCI 0.006456205 0.001534189 0.01137822 0.0062478
## 
## $Age.group
##                     diff          lwr          upr     p adj
## 76-86-66-75 -0.005293515 -0.009459874 -0.001127155 0.0129902
## 
## $`Diagnostic:Age.group`
##                             diff          lwr          upr     p adj
## MCI:66-75-AD:66-75   0.013238444 -0.002083987  0.028560875 0.1334998
## CTL:66-75-AD:66-75   0.017529528  0.003020306  0.032038749 0.0080072
## AD:76-86-AD:66-75   -0.007167645 -0.024107230  0.009771940 0.8288658
## MCI:76-86-AD:66-75   0.003983562 -0.012956023  0.020923147 0.9844669
## CTL:76-86-AD:66-75   0.013511823 -0.003165116  0.030188763 0.1870369
## CTL:66-75-MCI:66-75  0.004291084 -0.002635652  0.011217819 0.4806767
## AD:76-86-MCI:66-75  -0.020406089 -0.031560088 -0.009252091 0.0000049
## MCI:76-86-MCI:66-75 -0.009254882 -0.020408881  0.001899116 0.1660600
## CTL:76-86-MCI:66-75  0.000273379 -0.010477550  0.011024308 0.9999997
## AD:76-86-CTL:66-75  -0.024697173 -0.034704785 -0.014689560 0.0000000
## MCI:76-86-CTL:66-75 -0.013545966 -0.023553578 -0.003538353 0.0018026
## CTL:76-86-CTL:66-75 -0.004017705 -0.013574016  0.005538607 0.8326823
## MCI:76-86-AD:76-86   0.011151207 -0.002137297  0.024439711 0.1565704
## CTL:76-86-AD:76-86   0.020679468  0.007727437  0.033631499 0.0001057
## CTL:76-86-MCI:76-86  0.009528261 -0.003423770  0.022480292 0.2837503
boxplot(K ~ Diagnostic*Age.group,
data = dados_hemi_v1_agegroups,
col = "steelblue",
border = "black", 
las = 2 #make x-axis labels perpendicular
)

5.4.7.2 S

summary(aov(S ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##                       Df Sum Sq Mean Sq F value  Pr(>F)   
## Diagnostic             2 0.1454 0.07269   6.171 0.00244 **
## Age.group              1 0.0278 0.02782   2.362 0.12568   
## Diagnostic:Age.group   2 0.1197 0.05984   5.080 0.00692 **
## Residuals            236 2.7798 0.01178                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(S ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = S ~ Diagnostic * Age.group, data = dados_hemi_v1_agegroups)
## 
## $Diagnostic
##                diff         lwr          upr     p adj
## MCI-AD  -0.05354432 -0.11335321  0.006264576 0.0896562
## CTL-AD  -0.07844671 -0.13272125 -0.024172169 0.0022049
## CTL-MCI -0.02490239 -0.06340389  0.013599102 0.2808076
## 
## $Age.group
##                   diff          lwr        upr     p adj
## 76-86-66-75 0.02315851 -0.009432015 0.05574903 0.1628534
## 
## $`Diagnostic:Age.group`
##                              diff         lwr          upr     p adj
## MCI:66-75-AD:66-75  -0.1050311808 -0.22488786  0.014825495 0.1230629
## CTL:66-75-AD:66-75  -0.0981648521 -0.21166036  0.015330654 0.1326874
## AD:76-86-AD:66-75   -0.0303712353 -0.16287778  0.102135305 0.9861650
## MCI:76-86-AD:66-75  -0.0001112472 -0.13261779  0.132395293 1.0000000
## CTL:76-86-AD:66-75  -0.1082371945 -0.23868925  0.022214856 0.1660889
## CTL:66-75-MCI:66-75  0.0068663287 -0.04731668  0.061049342 0.9991552
## AD:76-86-MCI:66-75   0.0746599455 -0.01259000  0.161909886 0.1408959
## MCI:76-86-MCI:66-75  0.1049199336  0.01766999  0.192169874 0.0084559
## CTL:76-86-MCI:66-75 -0.0032060137 -0.08730302  0.080890993 0.9999978
## AD:76-86-CTL:66-75   0.0677936168 -0.01048894  0.146076178 0.1317426
## MCI:76-86-CTL:66-75  0.0980536048  0.01977104  0.176336167 0.0051684
## CTL:76-86-CTL:66-75 -0.0100723424 -0.08482469  0.064680008 0.9988630
## MCI:76-86-AD:76-86   0.0302599881 -0.07368669  0.134206670 0.9604243
## CTL:76-86-AD:76-86  -0.0778659592 -0.17918065  0.023448734 0.2378326
## CTL:76-86-MCI:76-86 -0.1081259473 -0.20944064 -0.006811254 0.0288454
boxplot(S ~ Diagnostic*Age.group,
data = dados_hemi_v1_agegroups,
col = "steelblue",
border = "black", 
las = 2 #make x-axis labels perpendicular
)

5.4.7.3 I

summary(aov(I ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##                       Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic             2 0.1164 0.05820  12.539 6.68e-06 ***
## Age.group              1 0.0194 0.01940   4.179    0.042 *  
## Diagnostic:Age.group   2 0.0134 0.00669   1.442    0.239    
## Residuals            236 1.0954 0.00464                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(I ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = I ~ Diagnostic * Age.group, data = dados_hemi_v1_agegroups)
## 
## $Diagnostic
##               diff          lwr        upr     p adj
## MCI-AD  0.03630915 -0.001235734 0.07385403 0.0604567
## CTL-AD  0.06616956  0.032098852 0.10024027 0.0000223
## CTL-MCI 0.02986041  0.005691192 0.05402963 0.0108786
## 
## $Age.group
##                    diff         lwr         upr     p adj
## 76-86-66-75 -0.01933867 -0.03979729 0.001119945 0.0638147
## 
## $`Diagnostic:Age.group`
##                             diff          lwr          upr     p adj
## MCI:66-75-AD:66-75   0.020861897 -0.054377832  0.096101627 0.9678734
## CTL:66-75-AD:66-75   0.056416424 -0.014830098  0.127662945 0.2084082
## AD:76-86-AD:66-75   -0.021891575 -0.105072226  0.061289075 0.9743911
## MCI:76-86-AD:66-75   0.021866109 -0.061314542  0.105046760 0.9745213
## CTL:76-86-AD:66-75   0.014816633 -0.067074317  0.096707583 0.9953589
## CTL:66-75-MCI:66-75  0.035554526  0.001541275  0.069567778 0.0346663
## AD:76-86-MCI:66-75  -0.042753473 -0.097524406  0.012017460 0.2223107
## MCI:76-86-MCI:66-75  0.001004212 -0.053766721  0.055775145 0.9999999
## CTL:76-86-MCI:66-75 -0.006045264 -0.058836951  0.046746422 0.9994840
## AD:76-86-CTL:66-75  -0.078307999 -0.127449682 -0.029166316 0.0001098
## MCI:76-86-CTL:66-75 -0.034550314 -0.083691998  0.014591369 0.3340230
## CTL:76-86-CTL:66-75 -0.041599791 -0.088525392  0.005325811 0.1149066
## MCI:76-86-AD:76-86   0.043757685 -0.021494586  0.109009956 0.3884048
## CTL:76-86-AD:76-86   0.036708208 -0.026891838  0.100308255 0.5607152
## CTL:76-86-MCI:76-86 -0.007049476 -0.070649523  0.056550570 0.9995599
boxplot(I ~ Diagnostic*Age.group,
data = dados_hemi_v1_agegroups,
col = "steelblue",
border = "black", 
las = 2 #make x-axis labels perpendicular
)

Figure 3

mean_K_I_S <-
  dados_hemi_v1 %>% group_by(Diagnostic) %>% summarise(
    mean.K = mean(Knorm, na.rm = TRUE),
    SD_K = sd(Knorm, na.rm = TRUE),
    mean.I = mean(Inorm, na.rm = TRUE),
    SD_I = sd(Inorm, na.rm = TRUE),
    mean.S = mean(Snorm, na.rm = TRUE),
    SD_S = sd(Snorm, na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
    )
fig3a <- ggplot(mean_K_I_S, aes(x = mean.K, y = mean.S, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

fig3a

ggplot(mean_K_I_S, aes(x = mean.K, y = mean.S, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1,aes(x = Knorm, y = Snorm, color = Diagnostic), alpha = 0.2) +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

fig3c <- ggplot(mean_K_I_S, aes(x = mean.K, y = mean.I, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

fig3c

ggplot(mean_K_I_S, aes(x = mean.K, y = mean.I, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1, aes(x = Knorm, y = Inorm, color = Diagnostic), alpha = 0.2) +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

mean_K_I_S_agegroups <-
  filter(dados_hemi_v1_agegroups) %>% group_by(Diagnostic, Age.group) %>% summarise(
    mean.T = mean(logAvgThickness, na.rm = TRUE),
    SD_T = sd(logAvgThickness, na.rm = TRUE),
    mean.K = mean(Knorm, na.rm = TRUE),
    SD_K = sd(Knorm, na.rm = TRUE),
    mean.I = mean(Inorm, na.rm = TRUE),
    SD_I = sd(Inorm, na.rm = TRUE),
    mean.S = mean(Snorm, na.rm = TRUE),
    SD_S = sd(Snorm, na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
  )
fig3b <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age.group ))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b

fig3b_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age.group))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Snorm, color = Diagnostic, shape = Age.group), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b_Alt

fig3d <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age.group ))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() +
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)")  +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom" , legend.box="vertical", legend.margin=margin())

fig3d

fig3d_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age.group))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Inorm, color = Diagnostic, shape = Age.group), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())
fig3d_Alt

fig3s <- ggarrange(fig3b, fig3d, labels = c("A", "B"), nrow=2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

#fig3s <- ggarrange(fig3a, fig3b,fig3c, fig3d, labels = c("A", "B","C","D"), nrow=2, ncol=2, font.label = list(size = 11))

# ("fig3s.pdf",fig3s, width = 9, height = 17.1, units = "cm", device = "pdf")
fig3s_Alt <- ggarrange(fig3b_Alt, fig3d_Alt, labels = c("A", "B"),ncol = 2, nrow=1, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s_Alt

#fig3s <- ggarrange(fig3a, fig3b,fig3c, fig3d, labels = c("A", "B","C","D"), nrow=2, ncol=2, font.label = list(size = 11))

ggsave("Figure3.png",fig3s_Alt, width = 18, height = 9, units = "cm", device = "png")
ggsave("Figure3.pdf",fig3s_Alt, width = 18, height = 9, units = "cm", device = "pdf")

# ggsave("fig3s.pdf",fig3s, dpi = 1200, width = 18, height = 17.1, units = "cm", device = "pdf")
fig3s
\label{fig:figure3}Morphological trajectory traced across the normalized independent components K, S,and I. We normalized the variable to the unity vectors providing comparable scale for the differences in both axes. (A, C) CTL as Control (blue, N~=~77) and the reference, MCI as Mild Cognitive Impairment (green, N~=~33) and AD for Alzheimer’s Disease (red, N~=~17). (B, D) Groups were divide in two subgroups, subjects with age between 65 and 75 years (circle, CTL N~=~67, MCI N~=~24, AD N~=~4) old and subjects with ages between 76 and 85 years old (triangle, CTL N~=~10, MCI N~=~9, AD N~=~9).

Morphological trajectory traced across the normalized independent components K, S,and I. We normalized the variable to the unity vectors providing comparable scale for the differences in both axes. (A, C) CTL as Control (blue, N=77) and the reference, MCI as Mild Cognitive Impairment (green, N=33) and AD for Alzheimer’s Disease (red, N=17). (B, D) Groups were divide in two subgroups, subjects with age between 65 and 75 years (circle, CTL N=67, MCI N=24, AD N=4) old and subjects with ages between 76 and 85 years old (triangle, CTL N=10, MCI N=9, AD N=9).

5.4.8 FIGURE 3 with age intervals

Diagnostic Age_interval10 N age age_range ESC
AD [60,70) 1 63 ± 0 63 ; 63 16 ± 0
AD [70,80) 8 76 ± 4.3 70 ; 80 12 ± 2.8
AD [80,90) 4 83 ± 2.1 80 ; 86 13 ± 3.2
MCI [60,70) 11 68 ± 2.4 62 ; 70 14 ± 2.6
MCI [70,80) 17 74 ± 2.6 70 ; 80 13 ± 2.4
MCI [80,90) 3 81 ± 0.87 80 ; 82 13 ± 2.1
CTL [40,50) 4 47 ± 2.5 43 ; 48 16 ± 2.6
CTL [50,60) 12 55 ± 3.5 50 ; 60 15 ± 2.3
CTL [60,70) 34 66 ± 2.9 60 ; 70 16 ± 1.6
CTL [70,80) 26 74 ± 2.5 70 ; 78 14 ± 2.4
CTL [80,90) 1 80 ± 0 80 ; 80 12 ± 0
mean_K_I_S_agegroups <-
  dados_hemi_v1_agegroups %>% group_by(Diagnostic, Age_interval10) %>% summarise(
    # mean.T = mean(logAvgThickness, na.rm = TRUE),
    # SD_T = sd(logAvgThickness, na.rm = TRUE),
    mean.K = mean(Knorm, na.rm = TRUE),
    SD_K = sd(Knorm, na.rm = TRUE),
    mean.I = mean(Inorm, na.rm = TRUE),
    SD_I = sd(Inorm, na.rm = TRUE),
    mean.S = mean(Snorm, na.rm = TRUE),
    SD_S = sd(Snorm, na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
  )

write.csv(mean_K_I_S_agegroups, "datafig3.csv")
fig3b <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b

fig3b_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Snorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b_Alt

fig3d <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() +
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)")  +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom" , legend.box="vertical", legend.margin=margin())

fig3d

fig3d_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Inorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())
fig3d_Alt

fig3s <- ggarrange(fig3b, fig3d, labels = c("A", "B"), nrow=2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s

fig3s_Alt_allgroups <- ggarrange(fig3b_Alt, fig3d_Alt, labels = c("A", "B"),ncol = 2, nrow=1, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s_Alt_allgroups

ggsave("fig3s_Alt_allgroups.png",fig3s_Alt_allgroups, width = 18, height = 9, units = "cm", device = "png")

5.4.9 FIGURE 3 with age intervals - age corrected

mean_K_I_S_agegroups <-
  filter(dados_hemi_v1_agegroups) %>% group_by(Diagnostic, Age_interval10) %>% summarise(
    mean.T = mean(logAvgThickness, na.rm = TRUE),
    SD_T = sd(logAvgThickness, na.rm = TRUE),
    mean.K = mean(K_age_decay/ sqrt(1 + (1 / 4) ^ 2 + (5 / 4) ^ 2), na.rm = TRUE),
    SD_K = sd(K_age_decay/ sqrt(1 + (1 / 4) ^ 2 + (5 / 4) ^ 2), na.rm = TRUE),
    mean.I = mean(I_age_decay/ sqrt(1 ^ 2 + 1 ^ 2 + 1 ^ 1), na.rm = TRUE),
    SD_I = sd(I_age_decay/ sqrt(1 ^ 2 + 1 ^ 2 + 1 ^ 1), na.rm = TRUE),
    mean.S = mean(S_age_decay/ sqrt((3 / 2) ^ 2 + (3 / 4) ^ 2 + (9 / 4) ^ 2), na.rm = TRUE),
    SD_S = sd(S_age_decay/ sqrt((3 / 2) ^ 2 + (3 / 4) ^ 2 + (9 / 4) ^ 2), na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
  )
fig3b <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b

fig3b_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Snorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b_Alt

fig3d <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() +
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)")  +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom" , legend.box="vertical", legend.margin=margin())

fig3d

fig3d_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Inorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())
fig3d_Alt

fig3s <- ggarrange(fig3b, fig3d, labels = c("A", "B"), nrow=2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s

fig3s_Alt <- ggarrange(fig3b_Alt, fig3d_Alt, labels = c("A", "B"),ncol = 2, nrow=1, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s_Alt

5.5 Behavioral and CSF data correlation

#hemisphere
dados_hemi_v1_CD <- dados_hemi_v1 %>%
  pivot_longer(
    c(
      COGNITIVE_INDEX,
      `A7/A5`,
      `TMT B-A`,
      `DIGIT SPAN BACK`,
      `AB1-40`,
      `AB1-42`,
      TAU,
      AB1_ratio,
      TAU_AB1_42_ratio,
      TAU_AB1_ratio,
      Lipoxina
    ),
    names_to = "clinical_test",
    values_to = "clinical_test_value"
  ) %>%
  pivot_longer(
    c(K, K_age_decay, logAvgThickness, logAvgThickness_age_decay),
    names_to = "morphological_parameter",
    values_to = "morphological_parameter_value")

dados_hemi_v1_CD_behaviour <-
  unique(
    filter(
      dados_hemi_v1_CD,
      clinical_test == "A7/A5" |
        clinical_test == "COGNITIVE_INDEX" |
        clinical_test == "TMT B-A" | clinical_test == "DIGIT SPAN BACK"
    )
  )

dados_hemi_v1_CD_biochq <-
  unique(
    filter(
      dados_hemi_v1_CD,
      clinical_test == "AB1-40" |
        clinical_test == "AB1-42" |
        clinical_test == "TAU" |
        clinical_test == "AB1_ratio" |
        clinical_test == "TAU_AB1_42_ratio" |
        clinical_test == "TAU_AB1_ratio" | clinical_test == "Lipoxina"
    )
  )
#frontal lobe
dados_lobos_v1_F_CD_behaviour <- filter(dados_lobos_v1, ROI == "F") %>%
  pivot_longer(
    c(
      `TMT B-A`,
      `DIGIT SPAN BACK`
    ),
    names_to = "clinical_test",
    values_to = "clinical_test_value"
  ) %>%
  pivot_longer(
    c(
      K_corrected,
      K_age_decay,
      logAvgThickness,
      logAvgThickness_age_decay
    ),
    names_to = "morphological_parameter",
    values_to = "morphological_parameter_value"
  )
#temporal lobe
dados_lobos_v1_T_CD_behaviour <- filter(dados_lobos_v1, ROI == "T") %>%
  pivot_longer(
    c(
      `A7/A5`,
    ),
    names_to = "clinical_test",
    values_to = "clinical_test_value"
  ) %>%
  pivot_longer(
    c(
      K_corrected,
      K_age_decay,
      logAvgThickness,
      logAvgThickness_age_decay
    ),
    names_to = "morphological_parameter",
    values_to = "morphological_parameter_value"
  )

5.5.1 Summary

dados_hemi_v1 %>%
group_by(Diagnostic) %>%
summarise(
N = n_distinct(SUBJ),
Mean_COGNITIVE_INDEX = mean(COGNITIVE_INDEX,  na.rm = TRUE),
STD_COGNITIVE_INDEX = sd(COGNITIVE_INDEX,  na.rm = TRUE),
Mean_A7_A5 = mean(`A7/A5`,  na.rm = TRUE),
STD_A7_A5 = sd(`A7/A5`,  na.rm = TRUE),
Mean_TMT_B_A = mean(`TMT B-A`,  na.rm = TRUE),
STD_TMT_B_A = sd(`TMT B-A`,  na.rm = TRUE),
Mean_DIGIT_SPAN_BACK = mean(`DIGIT SPAN BACK`,  na.rm = TRUE),
STD_DIGIT_SPAN_BACK = sd(`DIGIT SPAN BACK`,  na.rm = TRUE),
Mean_Lipoxina = mean(Lipoxina ,  na.rm = TRUE),
STD_Lipoxina = sd(Lipoxina ,  na.rm = TRUE),
Mean_AB1_40 = mean(`AB1-40`,  na.rm = TRUE),
STD_AB1_40 = sd(`AB1-40`,  na.rm = TRUE),
Mean_AB1_42 = mean(`AB1-42`,  na.rm = TRUE),
STD_AB1_42 = sd(`AB1-42`,  na.rm = TRUE),
Mean_TAU = mean(TAU,  na.rm = TRUE),
STD_TAU = sd(TAU,  na.rm = TRUE)) %>%
  kable(digits = 2) %>%
  kable_styling() %>%
  column_spec(1, width = "10cm")
Diagnostic N Mean_COGNITIVE_INDEX STD_COGNITIVE_INDEX Mean_A7_A5 STD_A7_A5 Mean_TMT_B_A STD_TMT_B_A Mean_DIGIT_SPAN_BACK STD_DIGIT_SPAN_BACK Mean_Lipoxina STD_Lipoxina Mean_AB1_40 STD_AB1_40 Mean_AB1_42 STD_AB1_42 Mean_TAU STD_TAU
AD 13 -3.35 1.48 0.24 0.31 226.69 131.29 3.77 1.39 79.10 73.64 5664.22 1665.88 279.71 60.00 632.00 278.83
MCI 31 -1.50 1.29 0.53 0.31 129.71 108.07 4.58 1.57 116.13 51.06 4989.81 2552.97 452.68 318.02 470.21 203.69
CTL 77 0.21 0.64 0.82 0.18 58.53 48.00 5.84 1.74 127.15 61.52 4192.04 1915.04 533.92 242.82 354.87 194.95
dados_hemi_v1_CD %>%
group_by(clinical_test, Diagnostic) %>%
summarise(
N = n_distinct(SUBJ),
Mean = mean(clinical_test_value,  na.rm = TRUE),
STD = sd(clinical_test_value,  na.rm = TRUE)) %>%
  kable(digits = 2) %>%
  kable_styling()
clinical_test Diagnostic N Mean STD
A7/A5 AD 13 0.24 0.31
A7/A5 MCI 31 0.53 0.31
A7/A5 CTL 77 0.82 0.18
AB1-40 AD 13 5664.22 1611.83
AB1-40 MCI 31 4989.81 2508.57
AB1-40 CTL 77 4192.04 1902.56
AB1-42 AD 13 279.71 58.05
AB1-42 MCI 31 452.68 312.49
AB1-42 CTL 77 533.92 241.24
AB1_ratio AD 13 0.05 0.01
AB1_ratio MCI 31 0.13 0.13
AB1_ratio CTL 77 0.16 0.12
COGNITIVE_INDEX AD 13 -3.35 1.46
COGNITIVE_INDEX MCI 31 -1.50 1.29
COGNITIVE_INDEX CTL 77 0.21 0.64
DIGIT SPAN BACK AD 13 3.77 1.37
DIGIT SPAN BACK MCI 31 4.58 1.56
DIGIT SPAN BACK CTL 77 5.84 1.74
Lipoxina AD 13 79.10 71.25
Lipoxina MCI 31 116.13 50.17
Lipoxina CTL 77 127.15 61.11
TAU AD 13 632.00 269.78
TAU MCI 31 470.21 200.15
TAU CTL 77 354.87 193.68
TAU_AB1_42_ratio AD 13 2.20 0.55
TAU_AB1_42_ratio MCI 31 1.61 1.53
TAU_AB1_42_ratio CTL 77 0.79 0.60
TAU_AB1_ratio AD 13 13027.12 6874.25
TAU_AB1_ratio MCI 31 7922.65 7198.30
TAU_AB1_ratio CTL 77 3429.86 3575.63
TMT B-A AD 13 226.69 129.37
TMT B-A MCI 31 129.71 107.41
TMT B-A CTL 77 58.53 47.88

5.5.2 Hemisphere

Corr2 <- dados_hemi_v1_CD_biochq %>%
  group_by(morphological_parameter, clinical_test) %>%
  summarise(
    t = signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$statistic,
      2
    ),
    df =  signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$parameter,
      2
    ),
    Correlation = signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$estimate,
      2
    ),
    pvalue = signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$p.value,
      4
    )
    ,
    eff.size = signif(
      res(
        Correlation,
        var.r = NULL,
        (df + 2) / 2,
        level = 95,
        dig = 2,
        verbose = FALSE
      )$d,
      2
    )
  ) %>%
  mutate(
    Diagnostic = "All",
    ROI = "Hemisphere",
    kind = "behaviour",
    Age_correction = ifelse(
      str_detect(morphological_parameter, "_age_decay", negate = FALSE),
      "yes",
      "no"
    )
  )

5.5.3 Frontal

5.5.4 Temporal

Corr_all <- full_join(Corr1, Corr2) %>%
  full_join(Corr3) %>%
  full_join(Corr4)

Corr_all$morphological_parameter[Corr_all$morphological_parameter == "K_corrected"] <- "K"
Corr_all$morphological_parameter[Corr_all$morphological_parameter == "K_age_decay"] <- "K"
Corr_all$morphological_parameter[Corr_all$morphological_parameter == "logAvgThickness_age_decay"] <- "logAvgThickness"

Corr_all <- Corr_all %>%
  group_by(morphological_parameter, clinical_test) %>%
  mutate(pval.adj = p.adjust(pvalue, method = 'bonferroni'))

Table 2 ## Raw

Corr_all %>%
  filter(Age_correction == "no") %>%
  # dplyr::select(-c(pvalue)) %>%
  kable(digits = 3) %>%
  kable_styling()
morphological_parameter clinical_test t df Correlation pvalue eff.size Diagnostic ROI kind Age_correction pval.adj
K A7/A5 5.90 240 0.360 0.000 0.77 All Hemisphere behaviour no 0.000
K COGNITIVE_INDEX 6.90 240 0.410 0.000 0.90 All Hemisphere behaviour no 0.000
K DIGIT SPAN BACK 4.00 240 0.250 0.000 0.52 All Hemisphere behaviour no 0.000
K TMT B-A -4.90 240 -0.300 0.000 -0.63 All Hemisphere behaviour no 0.000
logAvgThickness A7/A5 6.60 240 0.390 0.000 0.85 All Hemisphere behaviour no 0.000
logAvgThickness COGNITIVE_INDEX 6.80 240 0.400 0.000 0.87 All Hemisphere behaviour no 0.000
logAvgThickness DIGIT SPAN BACK 3.20 240 0.200 0.001 0.41 All Hemisphere behaviour no 0.005
logAvgThickness TMT B-A -3.50 240 -0.220 0.001 -0.45 All Hemisphere behaviour no 0.002
K AB1-40 -0.70 90 -0.073 0.487 -0.15 All Hemisphere behaviour no 0.975
K AB1-42 2.60 90 0.260 0.012 0.54 All Hemisphere behaviour no 0.024
K AB1_ratio 1.70 90 0.180 0.089 0.37 All Hemisphere behaviour no 0.177
K Lipoxina 1.10 88 0.110 0.293 0.22 All Hemisphere behaviour no 0.586
K TAU -2.60 90 -0.260 0.011 -0.54 All Hemisphere behaviour no 0.022
K TAU_AB1_42_ratio -3.20 90 -0.320 0.002 -0.68 All Hemisphere behaviour no 0.004
K TAU_AB1_ratio -2.80 90 -0.280 0.006 -0.58 All Hemisphere behaviour no 0.012
logAvgThickness AB1-40 -2.20 90 -0.220 0.034 -0.45 All Hemisphere behaviour no 0.068
logAvgThickness AB1-42 0.82 90 0.086 0.416 0.17 All Hemisphere behaviour no 0.833
logAvgThickness AB1_ratio 1.90 90 0.200 0.058 0.41 All Hemisphere behaviour no 0.115
logAvgThickness Lipoxina -0.49 88 -0.052 0.626 -0.10 All Hemisphere behaviour no 1.000
logAvgThickness TAU -4.30 90 -0.410 0.000 -0.90 All Hemisphere behaviour no 0.000
logAvgThickness TAU_AB1_42_ratio -3.40 90 -0.340 0.001 -0.72 All Hemisphere behaviour no 0.002
logAvgThickness TAU_AB1_ratio -4.00 90 -0.390 0.000 -0.85 All Hemisphere behaviour no 0.000
K DIGIT SPAN BACK 3.30 240 0.210 0.001 0.43 All Frontal lobe behaviour no 0.005
K TMT B-A -3.20 240 -0.210 0.001 -0.43 All Frontal lobe behaviour no 0.006
logAvgThickness DIGIT SPAN BACK 2.50 240 0.160 0.014 0.32 All Frontal lobe behaviour no 0.054
logAvgThickness TMT B-A -3.30 240 -0.210 0.001 -0.43 All Frontal lobe behaviour no 0.005
K A7/A5 4.90 240 0.310 0.000 0.65 All Temporal lobe behaviour no 0.000
logAvgThickness A7/A5 7.50 240 0.440 0.000 0.98 All Temporal lobe behaviour no 0.000

5.6 Age corrected

Corr_all %>%
  filter(Age_correction == "yes") %>%
  # dplyr::select(-c(pvalue)) %>%
  kable(digits = 3) %>%
  kable_styling()
morphological_parameter clinical_test t df Correlation pvalue eff.size Diagnostic ROI kind Age_correction pval.adj
K A7/A5 4.400 240 0.270 0.000 0.56 All Hemisphere behaviour yes 0.000
K COGNITIVE_INDEX 5.100 240 0.310 0.000 0.65 All Hemisphere behaviour yes 0.000
K DIGIT SPAN BACK 3.000 240 0.190 0.003 0.39 All Hemisphere behaviour yes 0.012
K TMT B-A -3.200 240 -0.200 0.002 -0.41 All Hemisphere behaviour yes 0.006
logAvgThickness A7/A5 4.200 240 0.260 0.000 0.54 All Hemisphere behaviour yes 0.000
logAvgThickness COGNITIVE_INDEX 4.200 240 0.260 0.000 0.54 All Hemisphere behaviour yes 0.000
logAvgThickness DIGIT SPAN BACK 1.800 240 0.110 0.079 0.22 All Hemisphere behaviour yes 0.318
logAvgThickness TMT B-A -1.100 240 -0.069 0.282 -0.14 All Hemisphere behaviour yes 1.000
K AB1-40 -0.180 90 -0.018 0.861 -0.04 All Hemisphere behaviour yes 1.000
K AB1-42 2.500 90 0.260 0.013 0.54 All Hemisphere behaviour yes 0.026
K AB1_ratio 1.600 90 0.160 0.124 0.32 All Hemisphere behaviour yes 0.248
K Lipoxina 1.300 88 0.130 0.212 0.26 All Hemisphere behaviour yes 0.424
K TAU -1.700 90 -0.180 0.091 -0.37 All Hemisphere behaviour yes 0.181
K TAU_AB1_42_ratio -2.400 90 -0.240 0.020 -0.49 All Hemisphere behaviour yes 0.040
K TAU_AB1_ratio -2.000 90 -0.200 0.051 -0.41 All Hemisphere behaviour yes 0.101
logAvgThickness AB1-40 -1.500 90 -0.160 0.133 -0.32 All Hemisphere behaviour yes 0.265
logAvgThickness AB1-42 0.007 90 0.001 0.994 0.00 All Hemisphere behaviour yes 1.000
logAvgThickness AB1_ratio 1.300 90 0.140 0.190 0.28 All Hemisphere behaviour yes 0.381
logAvgThickness Lipoxina -0.430 88 -0.046 0.670 -0.09 All Hemisphere behaviour yes 1.000
logAvgThickness TAU -2.800 90 -0.280 0.007 -0.58 All Hemisphere behaviour yes 0.014
logAvgThickness TAU_AB1_42_ratio -1.600 90 -0.170 0.114 -0.35 All Hemisphere behaviour yes 0.228
logAvgThickness TAU_AB1_ratio -2.300 90 -0.230 0.025 -0.47 All Hemisphere behaviour yes 0.050
K DIGIT SPAN BACK 2.300 240 0.150 0.023 0.30 All Frontal lobe behaviour yes 0.090
K TMT B-A -2.200 240 -0.140 0.031 -0.28 All Frontal lobe behaviour yes 0.122
logAvgThickness DIGIT SPAN BACK 1.100 240 0.072 0.270 0.14 All Frontal lobe behaviour yes 1.000
logAvgThickness TMT B-A -1.100 240 -0.071 0.273 -0.14 All Frontal lobe behaviour yes 1.000
K A7/A5 3.200 240 0.210 0.001 0.43 All Temporal lobe behaviour yes 0.006
logAvgThickness A7/A5 5.700 240 0.350 0.000 0.75 All Temporal lobe behaviour yes 0.000
======= Manuscript 1 from Fernanda Hansen P. de Moraes Thesis - Cortical folding alterations in humans due to aging and diseases

Description of the procedures and analysis present in Manuscript 1, Independent morphological correlates to aging, Mild Cognitive Impairment, and Alzheimer’s Disease, at the Doctorate Thesis presented to the Programa de Pós-Graduação em Ciências Médicas at the Instituto D’Or de Pesquisa e Ensino as a partial requirement to obtain the Doctorate Degree.

Part of the data used here cannot be shared due to restrictions of the Ethic Committee. Data can be shared upon reasonable request to the corresponding author. To fulfill these limitation, we will generate random data to simulate the results.

Get in touch with us () in case any help is needed, our aim is to improve the code as needed!

1 RMARKDOWN AND R SETUP

setwd("D:/GitHub/CorticalFolding_AD_Aging")
## define functions

# test angular coeficinet versus theoretical value
test_coef <- function(reg, coefnum, val){
  co <- coef(summary(reg))
  tstat <- (co[coefnum,1] - val)/co[coefnum,2]
  2 * pt(abs(tstat), reg$df.residual, lower.tail = FALSE)
}

# wrap text
wrapper <- function(x, ...) paste(strwrap(x, ...), collapse = "\n")
library(readr)
library(readxl)
library(tidyverse)
library(lubridate)
library(ggpubr)
library(kableExtra)
library(broom)
library(MASS)
library(cutpointr)
library(ggstatsplot)
library(effects)
library(car)
# library(multcomp)
library(emmeans)
library(compute.es)
# COLOR BLIND PALETTE WITH BLACK
cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
cbbPalette2 <- c("#D55E00", "#E69F00", "#56B4E9", "#0072B2", "#CC79A7", "#009E73", "#F0E442")

2 set seed for random process

set.seed(1)
dados_raw <- read_csv("dados_raw.csv")

3 DATA PREPARATION

# estimate cortical folding variables
dados_raw <- dados_raw %>%
  mutate(
    # create new variables
    logAvgThickness = log10(AvgThickness),
    logTotalArea = log10(TotalArea),
    logExposedArea = log10(ExposedArea),
    localGI = TotalArea / ExposedArea,
    k = sqrt(AvgThickness) * TotalArea / (ExposedArea ^ 1.25),
    K = 1 / 4 * log10(AvgThickness ^ 2)  + log10(TotalArea) - 5 / 4 * log10(ExposedArea),
    S = 3 / 2 * log10(TotalArea) + 3 / 4 * log10(ExposedArea) - 9 /  4 * log10(AvgThickness ^
                                                                                 2) ,
    I = log10(TotalArea) + log10(ExposedArea) + log10(AvgThickness ^ 2),
    c = as.double(ifelse(
      ROI == "hemisphere", NA, 4 * pi / GaussianCurvature
    )),
    TotalArea_corrected = ifelse(ROI == "hemisphere", TotalArea, TotalArea * c),
    ExposedArea_corrected = ifelse(ROI == "hemisphere", ExposedArea, ExposedArea * c),
    logTotalArea_corrected = log10(TotalArea_corrected),
    logExposedArea_corrected = log10(ExposedArea_corrected),
    localGI_corrected = ifelse(
      ROI == "hemisphere",
      TotalArea / ExposedArea,
      TotalArea_corrected / ExposedArea_corrected
    ),
    k_corrected = ifelse(
      ROI == "hemisphere",
      sqrt(AvgThickness) * log10(TotalArea) / (log10(ExposedArea) ^ 1.25),
      sqrt(AvgThickness) * log10(TotalArea_corrected) / (log10(ExposedArea_corrected ^
                                                                 1.25))
    ),
    K_corrected =  ifelse(
      ROI == "hemisphere",
      1 / 4 * log10(AvgThickness ^ 2) + log10(TotalArea) - 5 / 4 * log10(ExposedArea),
      1 / 4 * log10(AvgThickness ^ 2) + log10(TotalArea_corrected) - 5 / 4 * log10(ExposedArea_corrected)
    ),
    I_corrected = ifelse(
      ROI == "hemisphere",
      log10(TotalArea) + log10(ExposedArea) + log10(AvgThickness ^ 2) ,
      log10(TotalArea_corrected) + log10(ExposedArea_corrected) + log10(AvgThickness ^ 2)
    ),
    S_corrected = ifelse(
      ROI == "hemisphere",
      3 / 2 * log10(TotalArea) + 3 / 4 * log10(ExposedArea) - 9 /  4 * log10(AvgThickness ^ 2) ,
      3 / 2 * log10(TotalArea_corrected) + 3 / 4 * log10(ExposedArea_corrected) - 9 /  4 * log10(AvgThickness ^ 2)
    ),
    Knorm = K_corrected / sqrt(1 + (1 / 4) ^ 2 + (5 / 4) ^ 2),
    Snorm = S_corrected / sqrt((3 / 2) ^ 2 + (3 / 4) ^ 2 + (9 / 4) ^ 2),
    Inorm = I_corrected / sqrt(1 ^ 2 + 1 ^ 2 + 1 ^ 1)
  )

# create age intervals
dados_raw$Age_interval <- cut(dados_raw$Age,
                                       breaks = c(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100),
                                       right = FALSE,
                                       include.lowest = TRUE)

dados_raw$Age_interval10 <- cut(dados_raw$Age,
                                         breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100),
                                         right = FALSE,
                                         include.lowest = TRUE)
dados_all <- dados_raw %>% filter(
    Diagnostic == "CONTROLE" |
      Diagnostic == "CCL" |
      Diagnostic == "ALZ", !is.na(logAvgThickness), ExposedArea != 0 | !is.na(localGI), !is.infinite(logExposedArea)) %>% 
  droplevels()

dados <- dados_all
# rename diagnostics
dados$Diagnostic[dados$Diagnostic == "CONTROLE"] <- "CTL"
dados$Diagnostic[dados$Diagnostic == "ALZ"] <- "AD"
dados$Diagnostic[dados$Diagnostic == "CCL"] <- "MCI"
dados$Diagnostic <- factor(dados$Diagnostic, levels = c("AD", "MCI","CTL"))

# filter data
dados <- dados %>%
  filter(machine == "Philips-Achieva", # include only subjects acquired at Philips Achieva 3T
                          ESC == 8 | ESC > 8, # include only subjects with 8 years of scholarship or more
                          Session == 1) %>% # use only data from Session 1
  droplevels() # delete factor levels

Visual QC exclusion:

VisualQC <- read_excel("Verificacao qualidade segmentacao FS Zika e CCD.xlsx", 
    sheet = "AD - IDOR ses 1 long", col_types = c("text", 
        "text", "skip", "skip", "numeric", 
        "skip", "skip", "skip", "skip", "text", 
        "text")) %>%
  dplyr::select(-c(session)) %>%
  mutate(Session = 1)

dados <- full_join(dados, VisualQC) %>%
  filter(Classification == 1 | Classification == 2)

4 Deaging

# define age for deaging
Age.cor = 25

## Avg thickness ----
decay_AvgThickness <-
  filter(
    dados,
    Diagnostic == "CTL",!is.na(TotalArea),!is.nan(TotalArea),!is.infinite(TotalArea)
  ) %>%
  droplevels() %>%
  group_by(ROI) %>%
  do(fit_decay_AvgThickness = tidy(rlm(AvgThickness ~ Age, data = .), conf.int =
                                     TRUE)) %>%
  unnest(cols = c(fit_decay_AvgThickness)) %>%
  filter(term == "Age") %>%
  mutate(c_AvgThickness = estimate,
         std_error_c_AvgThickness = std.error) %>%
  dplyr::select(c(ROI, c_AvgThickness, std_error_c_AvgThickness))

## TotalArea ----
decay_TotalArea <-
  filter(
    dados,
    Diagnostic == "CTL",
    !is.na(TotalArea),
    !is.nan(TotalArea),
    !is.infinite(TotalArea)
  ) %>%
  droplevels() %>%
  group_by(ROI) %>%
  do(fit_decay_TotalArea = tidy(rlm(TotalArea ~ Age, data = .), conf.int =
                                  TRUE)) %>%
  unnest(cols = c(fit_decay_TotalArea)) %>%
  filter(term == "Age") %>%
  mutate(c_TotalArea = estimate,
         std_error_c_TotalArea = std.error) %>%
  dplyr::select(c(ROI, c_TotalArea, std_error_c_TotalArea))

## ExposedArea ----
decay_ExposedArea <-
  filter(
    dados,
    Diagnostic == "CTL",
    !is.na(ExposedArea),
    !is.nan(ExposedArea),
    !is.infinite(ExposedArea)
  ) %>%
  droplevels() %>%
  group_by(ROI) %>%
  do(fit_decay_ExposedArea = tidy(rlm(ExposedArea ~ Age, data = .), conf.int = TRUE)) %>%
  unnest(cols = c(fit_decay_ExposedArea)) %>%
  filter(term == "Age") %>%
  mutate(c_ExposedArea = estimate,
         std_error_c_ExposedArea = std.error) %>%
  dplyr::select(c(ROI, c_ExposedArea, std_error_c_ExposedArea))

## join
dados <- full_join(dados, decay_AvgThickness) %>%
  full_join(decay_TotalArea) %>%
  full_join(decay_ExposedArea) %>%
  mutate(
    AvgThickness_age_decay = AvgThickness - c_AvgThickness * (Age - Age.cor),
    logAvgThickness_age_decay = log10(AvgThickness_age_decay),
    TotalArea_age_decay = TotalArea - c_TotalArea * (Age - Age.cor),
    logTotalArea_age_decay = log10(TotalArea_age_decay),
    ExposedArea_age_decay = ExposedArea - c_ExposedArea * (Age - Age.cor),
    logExposedArea_age_decay = log10(ExposedArea_age_decay),
    localGI_age_decay = TotalArea_age_decay / ExposedArea_age_decay,
    K_age_decay = log10(TotalArea_age_decay) + 1/4*log10(AvgThickness_age_decay^2) - 5/4*log10(ExposedArea_age_decay),
    I_age_decay = log10(TotalArea_age_decay) + log10(ExposedArea_age_decay) + log10(AvgThickness_age_decay^2),
    S_age_decay = 3/2*log10(TotalArea_age_decay) + 3/4*log10(ExposedArea_age_decay) - 9/4*log10(AvgThickness_age_decay^2))

dados$logAvgThickness <- as.double(dados$logAvgThickness)
dados$logExposedArea <- as.double(dados$logExposedArea)
dados$logTotalArea   <- as.double(dados$logTotalArea)
dados_v1 <- filter(dados, ROI == "F" | ROI == "T" | ROI == "O" | ROI == "P" | ROI == "hemisphere") %>%
  droplevels()

# lobe data
dados_lobos_v1 <- unique(filter(dados, ROI == "F" | ROI == "T" | ROI == "O" | ROI == "P",  !is.na(K_age_decay), SUBJ != "SUBJ211", SUBJ != "SUBJ223")) %>%
  droplevels()

# hemisphere data
dados_hemi_v1 <- unique(filter(dados, ROI == "hemisphere", !is.na(K_age_decay)))

5 RESULTS

5.1 Data description

## # A tibble: 3 × 5
##   Diagnostic     N age      age_range ESC     
##   <fct>      <int> <chr>    <chr>     <chr>   
## 1 AD            13 77 ± 6.1 63 ;  86  13 ± 3  
## 2 MCI           31 72 ± 4.8 62 ;  82  13 ± 2.4
## 3 CTL           77 66 ± 8.4 43 ;  80  15 ± 2.2
## # A tibble: 6 × 3
## # Groups:   Diagnostic [3]
##   Diagnostic Gender     N
##   <fct>      <chr>  <int>
## 1 AD         FEM        8
## 2 AD         MASC       5
## 3 MCI        FEM       19
## 4 MCI        MASC      12
## 5 CTL        FEM       53
## 6 CTL        MASC      24
## # A tibble: 3 × 5
##   Diagnostic     N AvgThickness TotalArea    ExposedArea 
##   <fct>      <int> <chr>        <chr>        <chr>       
## 1 AD            13 2.4 ± 0.079  95000 ± 9300 37000 ± 3000
## 2 MCI           31 2.5 ± 0.088  97000 ± 8200 37000 ± 2600
## 3 CTL           77 2.5 ± 0.099  98000 ± 7800 37000 ± 2400
## # A tibble: 3 × 6
##   Diagnostic     N k             K             S          I         
##   <fct>      <int> <chr>         <chr>         <chr>      <chr>     
## 1 AD            13 0.28 ± 0.01   -0.55 ± 0.015 9.2 ± 0.13 10 ± 0.069
## 2 MCI           31 0.29 ± 0.0094 -0.53 ± 0.014 9.1 ± 0.13 10 ± 0.059
## 3 CTL           77 0.3 ± 0.0095  -0.52 ± 0.014 9.1 ± 0.1  10 ± 0.072
## # A tibble: 3 × 3
##   Diagnostic     N COGNITIVE_INDEX
##   <fct>      <int> <chr>          
## 1 AD            13 -3.4 ± 1.5     
## 2 MCI           31 -1.5 ± 1.3     
## 3 CTL           77 0.21 ± 0.64
## # A tibble: 3 × 5
##   Diagnostic     N `A7/A5`     `TMT B-A` `DIGIT SPAN BACK`
##   <fct>      <int> <chr>       <chr>     <chr>            
## 1 AD            13 0.24 ± 0.31 230 ± 130 3.8 ± 1.4        
## 2 MCI           31 0.53 ± 0.31 130 ± 110 4.6 ± 1.6        
## 3 CTL           77 0.82 ± 0.18 59 ± 48   5.8 ± 1.7
## # A tibble: 3 × 3
##   Diagnostic     N Lipoxin 
##   <fct>      <int> <chr>   
## 1 AD             6 79 ± 74 
## 2 MCI           11 120 ± 51
## 3 CTL           28 130 ± 62
## # A tibble: 3 × 5
##   Diagnostic     N `AB1-40`    `AB1-42`  TAU      
##   <fct>      <int> <chr>       <chr>     <chr>    
## 1 AD             6 5700 ± 1700 280 ± 60  630 ± 280
## 2 MCI           11 5000 ± 2600 450 ± 320 470 ± 200
## 3 CTL           29 4200 ± 1900 530 ± 240 350 ± 190

5.1.1 Stats tests

5.1.1.1 Age

summary(aov(Age ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2   3860  1929.9   35.03 4.56e-14 ***
## Residuals   239  13167    55.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(Age ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Age ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff        lwr        upr     p adj
## MCI-AD   -4.795676  -8.885726 -0.7056261 0.0168180
## CTL-AD  -11.214709 -14.926290 -7.5031268 0.0000000
## CTL-MCI  -6.419032  -9.051969 -3.7860952 0.0000001

5.1.1.2 Education

summary(aov(ESC ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2  286.7  143.35   25.96 6.26e-11 ***
## Residuals   239 1319.6    5.52                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(ESC ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ESC ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff        lwr      upr     p adj
## MCI-AD  0.5136476 -0.7811523 1.808448 0.6183314
## CTL-AD  2.6053946  1.4304075 3.780382 0.0000011
## CTL-MCI 2.0917470  1.2582298 2.925264 0.0000000

5.1.1.3 T

summary(aov(AvgThickness ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.4317 0.21586   24.38 2.31e-10 ***
## Residuals   239 2.1159 0.00885                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(AvgThickness ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = AvgThickness ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff        lwr        upr     p adj
## MCI-AD  0.08062434 0.02877651 0.13247217 0.0008791
## CTL-AD  0.13152344 0.08447329 0.17857360 0.0000000
## CTL-MCI 0.05089910 0.01752248 0.08427573 0.0011369

5.1.1.4 AT

summary(aov(TotalArea ~ Diagnostic, data = dados_hemi_v1))
##              Df    Sum Sq   Mean Sq F value Pr(>F)  
## Diagnostic    2 3.116e+08 155795551   2.385 0.0943 .
## Residuals   239 1.561e+10  65317698                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(TotalArea ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = TotalArea ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff        lwr      upr     p adj
## MCI-AD  1620.774 -2832.6439 6074.192 0.6670748
## CTL-AD  3310.973  -730.3529 7352.298 0.1318996
## CTL-MCI 1690.199 -1176.6532 4557.051 0.3475106

5.1.1.5 AE

summary(aov(ExposedArea ~ Diagnostic, data = dados_hemi_v1))
##              Df    Sum Sq Mean Sq F value Pr(>F)
## Diagnostic    2 7.095e+06 3547305   0.557  0.573
## Residuals   239 1.521e+09 6363529
TukeyHSD(aov(ExposedArea ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ExposedArea ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff        lwr      upr     p adj
## MCI-AD  -51.82309 -1441.8622 1338.216 0.9957469
## CTL-AD  318.18671  -943.2267 1579.600 0.8229883
## CTL-MCI 370.00980  -524.8168 1264.836 0.5932532

5.1.1.6 k

summary(aov(k ~ Diagnostic, data = dados_hemi_v1))
##              Df   Sum Sq   Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.005054 0.0025272   27.75 1.46e-11 ***
## Residuals   239 0.021770 0.0000911                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(k ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = k ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr         upr     p adj
## MCI-AD  0.010302216 0.005043183 0.015561248 0.0000187
## CTL-AD  0.014710931 0.009938538 0.019483325 0.0000000
## CTL-MCI 0.004408716 0.001023255 0.007794176 0.0066995

5.1.1.7 K

summary(aov(K ~ Diagnostic, data = dados_hemi_v1))
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01123 0.005617   28.51 7.88e-12 ***
## Residuals   239 0.04709 0.000197                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(K ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007779038 0.02324848 0.0000114
## CTL-AD  0.021969964 0.014950967 0.02898896 0.0000000
## CTL-MCI 0.006456205 0.001477040 0.01143537 0.0069835

5.1.1.8 S

summary(aov(S ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## Diagnostic    2 0.1454 0.07269   5.935 0.00305 **
## Residuals   239 2.9273 0.01225                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(S ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = S ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr          upr     p adj
## MCI-AD  -0.05354432 -0.11452812  0.007439493 0.0981486
## CTL-AD  -0.07844671 -0.13378745 -0.023105971 0.0027564
## CTL-MCI -0.02490239 -0.06416023  0.014355446 0.2946500

5.1.1.9 I

summary(aov(I ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.1164 0.05820   12.33 8.02e-06 ***
## Residuals   239 1.1282 0.00472                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(I ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = I ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff          lwr        upr     p adj
## MCI-AD  0.03630915 -0.001550483 0.07416878 0.0632732
## CTL-AD  0.06616956  0.031813228 0.10052589 0.0000263
## CTL-MCI 0.02986041  0.005488575 0.05423225 0.0116926

5.1.1.10 COGNITIVE_INDEX

summary(aov(COGNITIVE_INDEX ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value Pr(>F)    
## Diagnostic    2    347  173.49   188.4 <2e-16 ***
## Residuals   239    220    0.92                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(COGNITIVE_INDEX ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = COGNITIVE_INDEX ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff      lwr      upr p adj
## MCI-AD  1.852171 1.323438 2.380904     0
## CTL-AD  3.557509 3.077702 4.037317     0
## CTL-MCI 1.705339 1.364971 2.045707     0

5.1.1.11 A7/A5

summary(aov(`A7/A5` ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value Pr(>F)    
## Diagnostic    2  9.661   4.831   87.88 <2e-16 ***
## Residuals   239 13.137   0.055                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(`A7/A5` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `A7/A5` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff       lwr       upr p adj
## MCI-AD  0.2960104 0.1668189 0.4252020 5e-07
## CTL-AD  0.5878375 0.4706006 0.7050745 0e+00
## CTL-MCI 0.2918271 0.2086611 0.3749931 0e+00

5.1.1.12 TMT B-A

summary(aov(`TMT B-A` ~ Diagnostic, data = dados_hemi_v1))
##              Df  Sum Sq Mean Sq F value Pr(>F)    
## Diagnostic    2  730405  365202   58.35 <2e-16 ***
## Residuals   239 1495797    6259                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(`TMT B-A` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `TMT B-A` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff        lwr        upr p adj
## MCI-AD   -96.98263 -140.57549  -53.38977 1e-06
## CTL-AD  -168.15984 -207.71888 -128.60080 0e+00
## CTL-MCI  -71.17721  -99.23976  -43.11466 0e+00

5.1.1.13 Digit Span Backwards

summary(aov(`DIGIT SPAN BACK` ~ Diagnostic, data = dados_hemi_v1))
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic    2  138.6   69.30   24.95 1.45e-10 ***
## Residuals   239  664.0    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(`DIGIT SPAN BACK` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `DIGIT SPAN BACK` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff        lwr      upr     p adj
## MCI-AD  0.8114144 -0.1070322 1.729861 0.0953982
## CTL-AD  2.0749251  1.2414660 2.908384 0.0000000
## CTL-MCI 1.2635107  0.6722680 1.854753 0.0000027

5.1.1.14 Lipoxin

summary(aov(Lipoxina ~ Diagnostic, data = dados_hemi_v1))
##             Df Sum Sq Mean Sq F value Pr(>F)  
## Diagnostic   2  22927   11464   3.092 0.0504 .
## Residuals   87 322577    3708                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 152 observations deleted due to missingness
TukeyHSD(aov(Lipoxina ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Lipoxina ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff        lwr      upr     p adj
## MCI-AD  37.03091 -15.075120 89.13694 0.2130340
## CTL-AD  48.05357   1.866513 94.24063 0.0395011
## CTL-MCI 11.02266 -25.510935 47.55626 0.7526835

5.1.1.15 AB1-40

summary(aov(`AB1-40` ~ Diagnostic, data = dados_hemi_v1))
##             Df    Sum Sq  Mean Sq F value Pr(>F)  
## Diagnostic   2  26528248 13264124   3.136 0.0483 *
## Residuals   89 376438438  4229645                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 150 observations deleted due to missingness
TukeyHSD(aov(`AB1-40` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `AB1-40` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##               diff       lwr        upr     p adj
## MCI-AD   -674.4154 -2433.610 1084.77885 0.6330672
## CTL-AD  -1472.1773 -3026.785   82.42997 0.0673274
## CTL-MCI  -797.7619 -2025.190  429.66585 0.2731864

5.1.1.16 AB1-42

summary(aov(`AB1-42` ~ Diagnostic, data = dados_hemi_v1))
##             Df  Sum Sq Mean Sq F value Pr(>F)   
## Diagnostic   2  666278  333139   5.367 0.0063 **
## Residuals   89 5524285   62071                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 150 observations deleted due to missingness
TukeyHSD(aov(`AB1-42` ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = `AB1-42` ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##             diff       lwr      upr     p adj
## MCI-AD  172.9624 -40.14814 386.0729 0.1350205
## CTL-AD  254.2086  65.88193 442.5352 0.0050847
## CTL-MCI  81.2462 -67.44560 229.9380 0.3976177

5.1.1.17 TAU

summary(aov(TAU ~ Diagnostic, data = dados_hemi_v1))
##             Df  Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic   2  840654  420327    9.61 0.000166 ***
## Residuals   89 3892705   43738                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 150 observations deleted due to missingness
TukeyHSD(aov(TAU ~ Diagnostic, data = dados_hemi_v1))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = TAU ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##              diff       lwr         upr     p adj
## MCI-AD  -161.7855 -340.6782   17.107122 0.0846567
## CTL-AD  -277.1303 -435.2185 -119.042116 0.0002006
## CTL-MCI -115.3448 -240.1620    9.472512 0.0762203

5.2 Cortical Folding Model

summary(lm(
  1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
  data = dados_hemi_v1,
  na.action = na.omit
))
## 
## Call:
## lm(formula = 1/2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea), 
##     data = dados_hemi_v1, na.action = na.omit)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.044511 -0.009410  0.000803  0.010885  0.035521 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        -0.009399   0.153570  -0.061    0.951    
## log10(ExposedArea)  1.136373   0.033594  33.827   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01523 on 240 degrees of freedom
## Multiple R-squared:  0.8266, Adjusted R-squared:  0.8259 
## F-statistic:  1144 on 1 and 240 DF,  p-value: < 2.2e-16
# Displays confidence interval
tidy(lm(
  1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
  data = dados_hemi_v1,
  na.action = na.omit
), conf.int = TRUE)
## # A tibble: 2 × 7
##   term               estimate std.error statistic  p.value conf.low conf.high
##   <chr>                 <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
## 1 (Intercept)        -0.00940    0.154    -0.0612 9.51e- 1   -0.312     0.293
## 2 log10(ExposedArea)  1.14       0.0336   33.8    2.70e-93    1.07      1.20
paste(
  "Student's t test comparing slope with theoretical value 1.25. t = ",
  signif(abs(coef(summary(
    lm(
      1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
      data = dados_hemi_v1,
      na.action = na.omit
    )
  ))[2, 1] - 1.25) / coef(summary(
    lm(
      1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
      data = dados_hemi_v1,
      na.action = na.omit
    )
  ))[2, 2], 3) 
)
## [1] "Student's t test comparing slope with theoretical value 1.25. t =  3.38"
paste(
  "Student's t test comparing slope with theoretical value 1.25. p value = ",
  signif(test_coef(
    lm(
      1 / 2 * log10(AvgThickness) + log10(TotalArea) ~ log10(ExposedArea),
      data = dados_hemi_v1,
      na.action = na.omit
    ),
    2,
    1.25
  ),3)
)
## [1] "Student's t test comparing slope with theoretical value 1.25. p value =  0.000839"

5.2.0.1 Diagnostic

dados_hemi_v1 %>%
  group_by(Diagnostic) %>%
  do(fit_Age = tidy(
    lm(
      1 / 2 * log10(AvgThickness) +  log10(TotalArea) ~  log10(ExposedArea),
      data = .,
      na.action = na.omit
    ),
    conf.int = TRUE
  )) %>%
  unnest(cols = c(Diagnostic))
## # A tibble: 3 × 2
##   Diagnostic fit_Age         
##   <fct>      <list>          
## 1 AD         <tibble [2 × 7]>
## 2 MCI        <tibble [2 × 7]>
## 3 CTL        <tibble [2 × 7]>

5.3 Correlation within cortical fodling variables and age healthy subjects)

5.3.1 Slope alpha

lm_Age <-
  filter(
    dados_hemi_v1,
    Diagnostic == "CTL",
    Age_interval != "[40,45)",
    Age_interval != "[80,85)"
  ) %>%
  group_by(Age_interval) %>%
  do(fit_Age = tidy(
    lm(
      1 / 2 * log10(AvgThickness) +  log10(TotalArea) ~  log10(ExposedArea),
      data = .,
      na.action = na.omit
    ),
    conf.int = TRUE
  )) %>%
  unnest(cols = c(fit_Age))

lm_Age <- lm_Age %>% mutate(Age_interval = as.double((str_sub(Age_interval,2,3))))

cor <- cor.test(filter(lm_Age, term == "log10(ExposedArea)")$estimate, filter(lm_Age, term == "log10(ExposedArea)")$Age_interval)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(lm_Age, term == "log10(ExposedArea)")$estimate and filter(lm_Age, term == "log10(ExposedArea)")$Age_interval
## t = -2.8822, df = 5, p-value = 0.0345
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.96750265 -0.09146064
## sample estimates:
##        cor 
## -0.7901004
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = -2.58 [ -6.62 , 1.47 ] 
##   var(d) = 4.26 
##   p-value(d) = 0.32 
##   U3(d) = 0.5 % 
##   CLES(d) = 3.42 % 
##   Cliff's Delta = -0.93 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = -0.79 [ -1 , 0.94 ] 
##   var(r) = 0.06 
##   p-value(r) = 0.51 
##  
##  z [ 95 %CI] = -1.07 [ -3.84 , 1.7 ] 
##   var(z) = 2 
##   p-value(z) = 0.51 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 0.01 [ 0 , 14.3 ] 
##   p-value(OR) = 0.32 
##  
##  Log OR [ 95 %CI] = -4.68 [ -12.01 , 2.66 ] 
##   var(lOR) = 14.01 
##   p-value(Log OR) = 0.32 
##  
##  Other: 
##  
##  NNT = -5.01 
##  Total N = 3.5
res$d
## [1] -2.58
res$l.d
## [1] -6.62
res$u.d
## [1] 1.47

5.3.2 K

cor <- cor.test(filter(dados_hemi_v1, Diagnostic == "CTL")$K, filter(dados_hemi_v1, Diagnostic == "CTL")$Age)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "CTL")$K and filter(dados_hemi_v1, Diagnostic == "CTL")$Age
## t = -4.176, df = 152, p-value = 4.981e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4558437 -0.1713459
## sample estimates:
##        cor 
## -0.3208125
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = -0.68 [ -1.15 , -0.2 ] 
##   var(d) = 0.06 
##   p-value(d) = 0.01 
##   U3(d) = 24.91 % 
##   CLES(d) = 31.6 % 
##   Cliff's Delta = -0.37 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = -0.32 [ -0.51 , -0.1 ] 
##   var(r) = 0.01 
##   p-value(r) = 0.01 
##  
##  z [ 95 %CI] = -0.33 [ -0.56 , -0.1 ] 
##   var(z) = 0.01 
##   p-value(z) = 0.01 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 0.29 [ 0.12 , 0.69 ] 
##   p-value(OR) = 0.01 
##  
##  Log OR [ 95 %CI] = -1.23 [ -2.09 , -0.37 ] 
##   var(lOR) = 0.19 
##   p-value(Log OR) = 0.01 
##  
##  Other: 
##  
##  NNT = -7.37 
##  Total N = 77
res$d
## [1] -0.68
res$l.d
## [1] -1.15
res$u.d
## [1] -0.2

5.3.2.1 Diagnostic

cor.test(filter(dados_hemi_v1, Diagnostic == "AD")$K, filter(dados_hemi_v1, Diagnostic == "AD")$Age)
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "AD")$K and filter(dados_hemi_v1, Diagnostic == "AD")$Age
## t = -1.2939, df = 24, p-value = 0.208
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5848606  0.1464815
## sample estimates:
##        cor 
## -0.2553595
cor.test(filter(dados_hemi_v1, Diagnostic == "MCI")$K, filter(dados_hemi_v1, Diagnostic == "MCI")$Age)
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "MCI")$K and filter(dados_hemi_v1, Diagnostic == "MCI")$Age
## t = -1.8932, df = 60, p-value = 0.06315
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.45991952  0.01312119
## sample estimates:
##        cor 
## -0.2374251

5.3.3 S

cor <- cor.test(filter(dados_hemi_v1, Diagnostic == "CTL")$S, filter(dados_hemi_v1, Diagnostic == "CTL")$Age)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "CTL")$S and filter(dados_hemi_v1, Diagnostic == "CTL")$Age
## t = 1.546, df = 152, p-value = 0.1242
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03441253  0.27713228
## sample estimates:
##       cor 
## 0.1244254
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = 0.25 [ -0.2 , 0.7 ] 
##   var(d) = 0.05 
##   p-value(d) = 0.28 
##   U3(d) = 59.9 % 
##   CLES(d) = 57.04 % 
##   Cliff's Delta = 0.14 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = 0.12 [ -0.1 , 0.34 ] 
##   var(r) = 0.01 
##   p-value(r) = 0.29 
##  
##  z [ 95 %CI] = 0.13 [ -0.1 , 0.35 ] 
##   var(z) = 0.01 
##   p-value(z) = 0.29 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 1.58 [ 0.69 , 3.59 ] 
##   p-value(OR) = 0.28 
##  
##  Log OR [ 95 %CI] = 0.45 [ -0.37 , 1.28 ] 
##   var(lOR) = 0.18 
##   p-value(Log OR) = 0.28 
##  
##  Other: 
##  
##  NNT = 12.93 
##  Total N = 77
res$d
## [1] 0.25
res$l.d
## [1] -0.2
res$u.d
## [1] 0.7

5.3.4 I

cor <- cor.test(filter(dados_hemi_v1, Diagnostic == "CTL")$I, filter(dados_hemi_v1, Diagnostic == "CTL")$Age)

cor
## 
##  Pearson's product-moment correlation
## 
## data:  filter(dados_hemi_v1, Diagnostic == "CTL")$I and filter(dados_hemi_v1, Diagnostic == "CTL")$Age
## t = -6.6178, df = 152, p-value = 5.879e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5871863 -0.3402379
## sample estimates:
##        cor 
## -0.4729482
res <- res(cor$estimate, n = (cor$parameter + 2) / 2)
## Mean Differences ES: 
##  
##  d [ 95 %CI] = -1.07 [ -1.58 , -0.56 ] 
##   var(d) = 0.07 
##   p-value(d) = 0 
##   U3(d) = 14.15 % 
##   CLES(d) = 22.39 % 
##   Cliff's Delta = -0.55 
##  
##  Correlation ES: 
##  
##  r [ 95 %CI] = -0.47 [ -0.63 , -0.28 ] 
##   var(r) = 0.01 
##   p-value(r) = 0 
##  
##  z [ 95 %CI] = -0.51 [ -0.74 , -0.29 ] 
##   var(z) = 0.01 
##   p-value(z) = 0 
##  
##  Odds Ratio ES: 
##  
##  OR [ 95 %CI] = 0.14 [ 0.06 , 0.36 ] 
##   p-value(OR) = 0 
##  
##  Log OR [ 95 %CI] = -1.95 [ -2.87 , -1.02 ] 
##   var(lOR) = 0.22 
##   p-value(Log OR) = 0 
##  
##  Other: 
##  
##  NNT = -5.81 
##  Total N = 77
res$d
## [1] -1.07
res$l.d
## [1] -1.58
res$u.d
## [1] -0.56

5.3.5 data sharing - FIGURE 1

datafig1 <- dados_hemi_v1 %>%
  dplyr::select(c(Age, Diagnostic, AvgThickness, TotalArea, ExposedArea, K)) %>%
  mutate(x = log10(ExposedArea),
         y = log10(sqrt(AvgThickness) * TotalArea)) %>%
  dplyr::select(c(Age, Diagnostic, x, y, K))
write.csv(datafig1, "datafig1.csv")

FIGURE 1

fig2a <- ggplot(dados_hemi_v1,
                aes(
                  log10(ExposedArea),
                  log10(sqrt(AvgThickness) * TotalArea),
                  color = Diagnostic,
                  fill = Diagnostic,
                  alpha = 0.4
                )) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  geom_abline(slope = 1.25,
              intercept = coef(lm(
                log10(sqrt(AvgThickness) * TotalArea) ~ log10(ExposedArea),
                data = dados_hemi_v1,
                na.action = na.omit
              ))[1],
              color = "black") +
  labs(x = bquote(log[10]*A[E] ~ "["*mm^2*"]"),
       y = bquote(log[10]*A[T]*sqrt(T) ~ "["*mm^(3/2)*"]")) +
  guides(alpha = "none") +
  theme_pubr() +
  scale_x_continuous(limits = c(4.45, 4.65)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
fig1b <- ggplot(data = dados_hemi_v1, aes(Age, K, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]", y = "K [dimentionless]") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
fig1_alt_2 <-
  ggarrange(
    fig2a,
    fig1b,
    labels = c("A", "B"),
    ncol = 2,
    nrow = 1,
    common.legend = TRUE,
    legend = "bottom"
  )

ggsave("Figure1.png", plot = fig1_alt_2, width = 18, height = 9, units = "cm", device = "png")
<<<<<<< HEAD
ggsave("Figure1.pdf", plot = fig1_alt_2, width = 18, height = 9, units = "cm", device = "pdf")

=======
>>>>>>> 4d9cecbc0c825eb7d0bbaf2d56d55f2bd1ec1bdf
#ggsave("fig1_alt_2.pdf", plot = fig1_alt_2, dpi=1200, width = 9, height = 11.37, units = "cm", device = "pdf")
fig1_alt_2
\label{fig:figure1}Age and diagnostic effects in cortical gyrification. We included 77~CTL (blue), 33~MCI (green) and 13~AD (red) subjects. (A) Linear fitting with 95% Confidence Interval (CI) for the model variables in each Diagnostic group, CTL (adjusted R²~=~0.85, p~<~0.0001), MCI (adjusted R²~=~0.88, p~<~0.0001), and AD (adjusted R²~=~0.86, p~<~0.0001). As the severity of the disease increase, the linear tendency is downshifted, with smaller linear intercepts (K). (B) K linear tendency across age with 95% CI for the three diagnostics groups: AD (adjusted R²~=~0.026, p~=~0.21), MCI (adjusted R²~=~0.044, p~=~0.0051), and CTL (adjusted R²~=~0.097, p~<~0.0001)

Age and diagnostic effects in cortical gyrification. We included 77~CTL (blue), 33~MCI (green) and 13~AD (red) subjects. (A) Linear fitting with 95% Confidence Interval (CI) for the model variables in each Diagnostic group, CTL (adjusted R²=0.85, p<0.0001), MCI (adjusted R²=0.88, p<0.0001), and AD (adjusted R²=0.86, p<0.0001). As the severity of the disease increase, the linear tendency is downshifted, with smaller linear intercepts (K). (B) K linear tendency across age with 95% CI for the three diagnostics groups: AD (adjusted R²=0.026, p=0.21), MCI (adjusted R²=0.044, p=0.0051), and CTL (adjusted R²=0.097, p<0.0001)

5.4 Diagnostic discrimination

5.4.1 K difference

aov <- aov(K ~ Diagnostic, data = dados_hemi_v1)
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01123 0.005617   28.51 7.88e-12 ***
## Residuals   239 0.04709 0.000197                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007779038 0.02324848 0.0000114
## CTL-AD  0.021969964 0.014950967 0.02898896 0.0000000
## CTL-MCI 0.006456205 0.001477040 0.01143537 0.0069835
aov <- aov(K ~ Diagnostic + Gender + ESC, data = dados_hemi_v1)
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01123 0.005617  29.128 4.89e-12 ***
## Gender        1 0.00130 0.001301   6.745  0.00999 ** 
## ESC           1 0.00009 0.000087   0.452  0.50188    
## Residuals   237 0.04570 0.000193                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov, which = "Diagnostic")
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic + Gender + ESC, data = dados_hemi_v1)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007861380 0.02316614 0.0000091
## CTL-AD  0.021969964 0.015025689 0.02891424 0.0000000
## CTL-MCI 0.006456205 0.001530047 0.01138236 0.0062983

5.4.2 K is reduced with age, as cortical thickness, total area and exposed area

K decrease with age is shown on Figure 1 B. Cortical Thickness, Total area and Exposed area:

T <- ggplot(data = dados_hemi_v1, aes(Age, AvgThickness, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

AT <- ggplot(data = dados_hemi_v1, aes(Age, TotalArea, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]", y = "Total Area 10^-5 ") +
  scale_y_continuous(
    labels = function(x)
      x / 10000) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

AE <- ggplot(data = dados_hemi_v1, aes(Age, ExposedArea, color = Diagnostic, fill = Diagnostic, alpha = 0.4)) +
  geom_point() +
  geom_smooth(method = "lm", se = TRUE) +
  theme_pubr() +
    guides(alpha = "none", color = "none", fill = "none") + 
  labs(x = "Age [years]", y = "Exposed Area 10^-5 ") +
  scale_y_continuous(
    labels = function(x)
      x / 10000) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
ggarrange(T, AT, AE, ncol = 1, common.legend = TRUE, legend = "bottom")

5.4.3 Lobes diagnostic discrimination

5.4.3.1 Frontal Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "F"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.00921 0.004607   15.04 7.14e-07 ***
## Residuals   235 0.07198 0.000306                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "F"))
## 
## $Diagnostic
##                diff           lwr        upr     p adj
## MCI-AD  0.013855899  0.0041879684 0.02352383 0.0024340
## CTL-AD  0.019888810  0.0111241119 0.02865351 0.0000006
## CTL-MCI 0.006032911 -0.0002294776 0.01229530 0.0617486

5.4.3.2 Occipital Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "O"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01091 0.005455    10.1 6.18e-05 ***
## Residuals   235 0.12689 0.000540                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "O"))
## 
## $Diagnostic
##                diff          lwr        upr     p adj
## MCI-AD  0.014642877  0.001806195 0.02747956 0.0208079
## CTL-AD  0.021529149  0.009891742 0.03316656 0.0000568
## CTL-MCI 0.006886272 -0.001428671 0.01520122 0.1262601

5.4.3.3 Parietal Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "P"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic    2 0.01261 0.006304   16.82 1.49e-07 ***
## Residuals   235 0.08807 0.000375                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "P"))
## 
## $Diagnostic
##               diff         lwr         upr     p adj
## MCI-AD  0.02207297  0.01137842 0.032767522 0.0000062
## CTL-AD  0.02369360  0.01399820 0.033389007 0.0000001
## CTL-MCI 0.00162063 -0.00530675 0.008548009 0.8456570

5.4.3.4 Temporal Lobe

aov <- aov(K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "T"))
summary(aov)
##              Df  Sum Sq  Mean Sq F value  Pr(>F)    
## Diagnostic    2 0.01908 0.009542   27.61 1.7e-11 ***
## Residuals   235 0.08122 0.000346                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic, data = filter(dados_lobos_v1, ROI == "T"))
## 
## $Diagnostic
##               diff         lwr        upr     p adj
## MCI-AD  0.01624932 0.005979382 0.02651925 0.0006953
## CTL-AD  0.02747185 0.018161394 0.03678231 0.0000000
## CTL-MCI 0.01122254 0.004570201 0.01787487 0.0002710

5.4.4 Difference in K between diagnostics decrease with age?

We compared age intervals of 10 years to increase N at each comparison.

5.4.4.1 K

Linear model for visual inspection:

b <- lm(K ~ Age * ROI * Diagnostic, data = dados)
summary(b)
## 
## Call:
## lm(formula = K ~ Age * ROI * Diagnostic, data = dados)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.062579 -0.011983  0.000438  0.012537  0.061381 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     -4.175e-01  4.625e-02  -9.026   <2e-16 ***
## Age                             -9.139e-04  5.982e-04  -1.528   0.1269    
## ROIhemisphere                   -7.977e-02  6.541e-02  -1.219   0.2229    
## ROIO                             7.811e-02  6.541e-02   1.194   0.2327    
## ROIP                             1.091e-01  6.541e-02   1.667   0.0957 .  
## ROIT                             7.845e-02  6.541e-02   1.199   0.2306    
## DiagnosticMCI                   -3.406e-02  5.779e-02  -0.589   0.5557    
## DiagnosticCTL                   -1.502e-02  4.777e-02  -0.315   0.7532    
## Age:ROIhemisphere                2.715e-04  8.460e-04   0.321   0.7483    
## Age:ROIO                         4.846e-04  8.460e-04   0.573   0.5669    
## Age:ROIP                         5.873e-05  8.460e-04   0.069   0.9447    
## Age:ROIT                         2.245e-04  8.460e-04   0.265   0.7908    
## Age:DiagnosticMCI                5.879e-04  7.664e-04   0.767   0.4432    
## Age:DiagnosticCTL                3.757e-04  6.245e-04   0.602   0.5475    
## ROIhemisphere:DiagnosticMCI      5.027e-02  8.220e-02   0.612   0.5410    
## ROIO:DiagnosticMCI               3.208e-02  8.173e-02   0.392   0.6948    
## ROIP:DiagnosticMCI               6.215e-02  8.173e-02   0.760   0.4472    
## ROIT:DiagnosticMCI               1.087e-01  8.173e-02   1.331   0.1836    
## ROIhemisphere:DiagnosticCTL      2.221e-02  6.751e-02   0.329   0.7422    
## ROIO:DiagnosticCTL               3.178e-02  6.755e-02   0.470   0.6382    
## ROIP:DiagnosticCTL               1.799e-02  6.755e-02   0.266   0.7901    
## ROIT:DiagnosticCTL               4.475e-02  6.755e-02   0.662   0.5078    
## Age:ROIhemisphere:DiagnosticMCI -6.400e-04  1.090e-03  -0.587   0.5573    
## Age:ROIO:DiagnosticMCI          -4.039e-04  1.084e-03  -0.373   0.7095    
## Age:ROIP:DiagnosticMCI          -7.412e-04  1.084e-03  -0.684   0.4942    
## Age:ROIT:DiagnosticMCI          -1.456e-03  1.084e-03  -1.343   0.1795    
## Age:ROIhemisphere:DiagnosticCTL -2.606e-04  8.826e-04  -0.295   0.7678    
## Age:ROIO:DiagnosticCTL          -3.753e-04  8.832e-04  -0.425   0.6710    
## Age:ROIP:DiagnosticCTL          -2.050e-04  8.832e-04  -0.232   0.8165    
## Age:ROIT:DiagnosticCTL          -5.254e-04  8.832e-04  -0.595   0.5521    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01836 on 1172 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.9403, Adjusted R-squared:  0.9389 
## F-statistic: 636.9 on 29 and 1172 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: K
##                      Df Sum Sq Mean Sq   F value    Pr(>F)    
## Age                   1 0.0585 0.05847  173.5006 < 2.2e-16 ***
## ROI                   4 6.1367 1.53418 4552.3579 < 2.2e-16 ***
## Diagnostic            2 0.0233 0.01164   34.5456 2.646e-15 ***
## Age:ROI               4 0.0028 0.00069    2.0496   0.08531 .  
## Age:Diagnostic        2 0.0002 0.00010    0.2939   0.74544    
## ROI:Diagnostic        8 0.0019 0.00024    0.7142   0.67917    
## Age:ROI:Diagnostic    8 0.0009 0.00012    0.3524   0.94499    
## Residuals          1172 0.3950 0.00034                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "K") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

Removing MCI for clear plots

b <- lm(K ~ Age * ROI * Diagnostic, data = filter(dados, Diagnostic != "MCI"))
summary(b)
## 
## Call:
## lm(formula = K ~ Age * ROI * Diagnostic, data = filter(dados, 
##     Diagnostic != "MCI"))
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.062579 -0.011513  0.000543  0.012219  0.061381 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                     -4.175e-01  4.642e-02  -8.993   <2e-16 ***
## Age                             -9.139e-04  6.004e-04  -1.522    0.128    
## ROIhemisphere                   -7.977e-02  6.565e-02  -1.215    0.225    
## ROIO                             7.811e-02  6.565e-02   1.190    0.234    
## ROIP                             1.091e-01  6.565e-02   1.661    0.097 .  
## ROIT                             7.845e-02  6.565e-02   1.195    0.232    
## DiagnosticCTL                   -1.502e-02  4.794e-02  -0.313    0.754    
## Age:ROIhemisphere                2.715e-04  8.491e-04   0.320    0.749    
## Age:ROIO                         4.846e-04  8.491e-04   0.571    0.568    
## Age:ROIP                         5.873e-05  8.491e-04   0.069    0.945    
## Age:ROIT                         2.245e-04  8.491e-04   0.264    0.792    
## Age:DiagnosticCTL                3.757e-04  6.268e-04   0.599    0.549    
## ROIhemisphere:DiagnosticCTL      2.221e-02  6.776e-02   0.328    0.743    
## ROIO:DiagnosticCTL               3.178e-02  6.780e-02   0.469    0.639    
## ROIP:DiagnosticCTL               1.799e-02  6.780e-02   0.265    0.791    
## ROIT:DiagnosticCTL               4.475e-02  6.780e-02   0.660    0.509    
## Age:ROIhemisphere:DiagnosticCTL -2.606e-04  8.859e-04  -0.294    0.769    
## Age:ROIO:DiagnosticCTL          -3.753e-04  8.865e-04  -0.423    0.672    
## Age:ROIP:DiagnosticCTL          -2.050e-04  8.865e-04  -0.231    0.817    
## Age:ROIT:DiagnosticCTL          -5.254e-04  8.865e-04  -0.593    0.554    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.01843 on 868 degrees of freedom
## Multiple R-squared:  0.9401, Adjusted R-squared:  0.9388 
## F-statistic: 716.9 on 19 and 868 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: K
##                     Df Sum Sq Mean Sq   F value    Pr(>F)    
## Age                  1 0.0507 0.05069  149.3168 < 2.2e-16 ***
## ROI                  4 4.5483 1.13708 3349.3340 < 2.2e-16 ***
## Diagnostic           1 0.0233 0.02333   68.7283 4.275e-16 ***
## Age:ROI              4 0.0016 0.00040    1.1900    0.3137    
## Age:Diagnostic       1 0.0000 0.00005    0.1337    0.7147    
## ROI:Diagnostic       4 0.0002 0.00005    0.1552    0.9607    
## Age:ROI:Diagnostic   4 0.0001 0.00003    0.0976    0.9832    
## Residuals          868 0.2947 0.00034                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "K") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

5.4.4.2 S

b <- lm(S ~ Age * ROI * Diagnostic, data = dados)
summary(b)
## 
## Call:
## lm(formula = S ~ Age * ROI * Diagnostic, data = dados)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.42942 -0.08443  0.00251  0.08212  0.35780 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      8.2997167  0.3044376  27.262   <2e-16 ***
## Age                             -0.0012310  0.0039376  -0.313   0.7546    
## ROIhemisphere                    0.9512429  0.4305398   2.209   0.0273 *  
## ROIO                            -0.6285586  0.4305398  -1.460   0.1446    
## ROIP                            -0.2881705  0.4305398  -0.669   0.5034    
## ROIT                            -0.8484631  0.4305398  -1.971   0.0490 *  
## DiagnosticMCI                   -0.9129225  0.3804014  -2.400   0.0166 *  
## DiagnosticCTL                   -0.2889535  0.3144115  -0.919   0.3583    
## Age:ROIhemisphere                0.0005630  0.0055686   0.101   0.9195    
## Age:ROIO                        -0.0008315  0.0055686  -0.149   0.8813    
## Age:ROIP                         0.0013346  0.0055686   0.240   0.8106    
## Age:ROIT                         0.0014435  0.0055686   0.259   0.7955    
## Age:DiagnosticMCI                0.0118343  0.0050447   2.346   0.0191 *  
## Age:DiagnosticCTL                0.0029387  0.0041108   0.715   0.4748    
## ROIhemisphere:DiagnosticMCI      0.0593214  0.5410439   0.110   0.9127    
## ROIO:DiagnosticMCI               0.8581515  0.5379688   1.595   0.1109    
## ROIP:DiagnosticMCI               0.1174156  0.5379688   0.218   0.8273    
## ROIT:DiagnosticMCI               0.1581980  0.5379688   0.294   0.7688    
## ROIhemisphere:DiagnosticCTL      0.0607655  0.4443808   0.137   0.8913    
## ROIO:DiagnosticCTL               0.1167024  0.4446450   0.262   0.7930    
## ROIP:DiagnosticCTL               0.0829354  0.4446450   0.187   0.8521    
## ROIT:DiagnosticCTL               0.0912829  0.4446450   0.205   0.8374    
## Age:ROIhemisphere:DiagnosticMCI -0.0008106  0.0071763  -0.113   0.9101    
## Age:ROIO:DiagnosticMCI          -0.0115071  0.0071343  -1.613   0.1070    
## Age:ROIP:DiagnosticMCI          -0.0013543  0.0071343  -0.190   0.8495    
## Age:ROIT:DiagnosticMCI          -0.0025714  0.0071343  -0.360   0.7186    
## Age:ROIhemisphere:DiagnosticCTL -0.0007791  0.0058095  -0.134   0.8933    
## Age:ROIO:DiagnosticCTL          -0.0011890  0.0058135  -0.205   0.8380    
## Age:ROIP:DiagnosticCTL          -0.0005318  0.0058135  -0.091   0.9271    
## Age:ROIT:DiagnosticCTL          -0.0017767  0.0058135  -0.306   0.7600    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1208 on 1172 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.9654, Adjusted R-squared:  0.9646 
## F-statistic:  1128 on 29 and 1172 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: S
##                      Df Sum Sq Mean Sq   F value    Pr(>F)    
## Age                   1   0.46   0.457   31.3054 2.743e-08 ***
## ROI                   4 476.22 119.054 8154.1728 < 2.2e-16 ***
## Diagnostic            2   0.24   0.122    8.3801 0.0002434 ***
## Age:ROI               4   0.14   0.036    2.4546 0.0441904 *  
## Age:Diagnostic        2   0.30   0.152   10.3981 3.340e-05 ***
## ROI:Diagnostic        8   0.08   0.010    0.7096 0.6832655    
## Age:ROI:Diagnostic    8   0.11   0.013    0.8990 0.5164846    
## Residuals          1172  17.11   0.015                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "S") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

5.4.4.3 I

b <- lm(I ~ Age * ROI * Diagnostic, data = dados)
summary(b)
## 
## Call:
## lm(formula = I ~ Age * ROI * Diagnostic, data = dados)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.26868 -0.04955 -0.00019  0.05248  0.36594 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      9.542e+00  1.988e-01  47.994  < 2e-16 ***
## Age                             -7.871e-04  2.572e-03  -0.306  0.75959    
## ROIhemisphere                    8.241e-01  2.812e-01   2.931  0.00344 ** 
## ROIO                            -8.602e-01  2.812e-01  -3.059  0.00227 ** 
## ROIP                            -4.074e-01  2.812e-01  -1.449  0.14763    
## ROIT                            -5.307e-01  2.812e-01  -1.887  0.05937 .  
## DiagnosticMCI                    2.074e-01  2.484e-01   0.835  0.40396    
## DiagnosticCTL                    2.562e-01  2.053e-01   1.248  0.21233    
## Age:ROIhemisphere               -1.168e-04  3.637e-03  -0.032  0.97438    
## Age:ROIO                        -3.853e-03  3.637e-03  -1.059  0.28963    
## Age:ROIP                         1.826e-05  3.637e-03   0.005  0.99599    
## Age:ROIT                         9.093e-04  3.637e-03   0.250  0.80261    
## Age:DiagnosticMCI               -2.451e-03  3.295e-03  -0.744  0.45703    
## Age:DiagnosticCTL               -3.180e-03  2.685e-03  -1.185  0.23640    
## ROIhemisphere:DiagnosticMCI     -2.010e-01  3.533e-01  -0.569  0.56956    
## ROIO:DiagnosticMCI              -6.063e-01  3.513e-01  -1.726  0.08466 .  
## ROIP:DiagnosticMCI              -1.202e-01  3.513e-01  -0.342  0.73231    
## ROIT:DiagnosticMCI              -1.063e-01  3.513e-01  -0.303  0.76223    
## ROIhemisphere:DiagnosticCTL      7.263e-03  2.902e-01   0.025  0.98004    
## ROIO:DiagnosticCTL              -2.995e-01  2.904e-01  -1.031  0.30253    
## ROIP:DiagnosticCTL               1.346e-02  2.904e-01   0.046  0.96303    
## ROIT:DiagnosticCTL               1.367e-01  2.904e-01   0.471  0.63786    
## Age:ROIhemisphere:DiagnosticMCI  2.805e-03  4.687e-03   0.598  0.54964    
## Age:ROIO:DiagnosticMCI           7.990e-03  4.659e-03   1.715  0.08664 .  
## Age:ROIP:DiagnosticMCI           1.594e-03  4.659e-03   0.342  0.73237    
## Age:ROIT:DiagnosticMCI           1.806e-03  4.659e-03   0.388  0.69834    
## Age:ROIhemisphere:DiagnosticCTL  3.065e-05  3.794e-03   0.008  0.99356    
## Age:ROIO:DiagnosticCTL           3.743e-03  3.797e-03   0.986  0.32441    
## Age:ROIP:DiagnosticCTL          -1.230e-04  3.797e-03  -0.032  0.97416    
## Age:ROIT:DiagnosticCTL          -1.218e-03  3.797e-03  -0.321  0.74838    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07891 on 1172 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.9859, Adjusted R-squared:  0.9855 
## F-statistic:  2821 on 29 and 1172 DF,  p-value: < 2.2e-16
aov <- anova(b)
aov
## Analysis of Variance Table
## 
## Response: I
##                      Df Sum Sq Mean Sq    F value    Pr(>F)    
## Age                   1   1.58   1.577   253.1826 < 2.2e-16 ***
## ROI                   4 507.63 126.907 20379.2427 < 2.2e-16 ***
## Diagnostic            2   0.06   0.032     5.1340  0.006026 ** 
## Age:ROI               4   0.01   0.003     0.4110  0.800848    
## Age:Diagnostic        2   0.08   0.042     6.7432  0.001225 ** 
## ROI:Diagnostic        8   0.04   0.005     0.8379  0.569185    
## Age:ROI:Diagnostic    8   0.03   0.003     0.5435  0.824144    
## Residuals          1172   7.30   0.006                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
e <- allEffects(b)
e <- as.data.frame(e[[1]])
ggplot(e, aes(
  x = Age,
  y = fit,
  color = Diagnostic,
  ymin = lower,
  ymax = upper
)) +
  geom_pointrange() +
  geom_line() +
  theme_pubr() +
  facet_wrap(ROI ~ .) +
  labs(y = "I") +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

5.4.5 Optimal cut-offs

5.4.5.1 K

## Method: maximize_boot_metric 
## Predictor: K 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.8442 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.5402        1.4341 0.8167      0.5769      0.8571 15 11 22 132
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5705655 -0.5554250 -0.5369054 -0.5277599 -0.5279802 -0.5160266
##       AD -0.5705655 -0.5675134 -0.5595947 -0.5523513 -0.5467767 -0.5315364
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.5553652 -0.5484493 -0.5346425 -0.5249779 -0.5248068 -0.5145646
##         95%       Max.         SD NAs
##  -0.5032479 -0.4974075 0.01602744   0
##  -0.5260303 -0.5225081 0.01543894   0
##          NA         NA         NA   0
##  -0.5028530 -0.4974075 0.01383501   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.55 -0.55   -0.54  -0.54 -0.54   -0.53 -0.53 -0.52 0.01
##              AUC_b  0.67  0.78    0.82   0.85  0.84    0.87  0.90  0.96 0.04
##            AUC_oob  0.60  0.74    0.81   0.85  0.84    0.88  0.93  1.00 0.06
##    sum_sens_spec_b  1.12  1.26    1.37   1.46  1.46    1.55  1.67  1.85 0.12
##  sum_sens_spec_oob  0.85  1.19    1.33   1.42  1.41    1.50  1.62  1.81 0.13
##              acc_b  0.48  0.65    0.72   0.78  0.78    0.85  0.92  0.96 0.08
##            acc_oob  0.49  0.62    0.71   0.78  0.77    0.84  0.90  0.97 0.09
##      sensitivity_b  0.40  0.50    0.58   0.63  0.66    0.71  0.88  1.00 0.11
##    sensitivity_oob  0.00  0.33    0.50   0.60  0.62    0.75  0.93  1.00 0.19
##      specificity_b  0.43  0.63    0.73   0.81  0.80    0.89  0.95  0.99 0.10
##    specificity_oob  0.36  0.58    0.71   0.81  0.79    0.89  0.96  1.00 0.12
##     cohens_kappa_b  0.08  0.16    0.25   0.33  0.36    0.47  0.65  0.83 0.15
##   cohens_kappa_oob -0.08  0.13    0.23   0.31  0.32    0.39  0.53  0.78 0.12
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## Method: maximize_boot_metric 
## Predictor: K 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.6274 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##           -0.5277        1.1295 0.5648      0.5645      0.5649 35 27 67 87
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5680537 -0.5500565 -0.5366192 -0.5269576 -0.5266599 -0.5162116
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.5680537 -0.5529256 -0.5399022 -0.5314849 -0.5312630 -0.5222311
##      CTL -0.5553652 -0.5484493 -0.5346425 -0.5249779 -0.5248068 -0.5145646
##         95%       Max.         SD NAs
##  -0.5045346 -0.4974075 0.01413782   0
##          NA         NA         NA   0
##  -0.5081443 -0.5055914 0.01393539   0
##  -0.5028530 -0.4974075 0.01383501   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.54 -0.53   -0.53  -0.53 -0.53   -0.52 -0.52 -0.51 0.00
##              AUC_b  0.48  0.56    0.60   0.63  0.63    0.65  0.69  0.76 0.04
##            AUC_oob  0.41  0.54    0.59   0.63  0.63    0.66  0.72  0.82 0.05
##    sum_sens_spec_b  0.96  1.06    1.14   1.19  1.19    1.24  1.32  1.41 0.07
##  sum_sens_spec_oob  0.85  1.00    1.09   1.15  1.15    1.21  1.30  1.53 0.09
##              acc_b  0.39  0.50    0.54   0.58  0.58    0.63  0.68  0.76 0.06
##            acc_oob  0.37  0.46    0.52   0.57  0.57    0.61  0.67  0.73 0.06
##      sensitivity_b  0.30  0.46    0.54   0.62  0.63    0.71  0.81  0.90 0.11
##    sensitivity_oob  0.19  0.35    0.48   0.59  0.59    0.70  0.83  1.00 0.15
##      specificity_b  0.23  0.40    0.47   0.55  0.56    0.66  0.75  0.89 0.11
##    specificity_oob  0.20  0.36    0.46   0.55  0.56    0.65  0.76  0.86 0.12
##     cohens_kappa_b -0.03  0.05    0.11   0.16  0.16    0.20  0.27  0.40 0.07
##   cohens_kappa_oob -0.12  0.00    0.07   0.12  0.12    0.17  0.24  0.37 0.07
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
roc_K_AD <- cpK$roc_curve[[1]]
roc_K_MCI <- cpK_MCI$roc_curve[[1]]

write.csv(cpK$roc_curve[[1]], "datafig2a_rocAD.csv")
write.csv(cpK_MCI$roc_curve[[1]], "datafig2a_rocMCI.csv")

5.4.5.2 log Avg Thickness

cpT <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
       logAvgThickness,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.8492 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##            0.3882        1.4965 0.7333      0.7692      0.7273 20  6 42 112
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.3493389 0.3647104 0.3833783 0.3960273 0.3958050 0.4074788 0.4267862
##       AD 0.3493389 0.3567966 0.3626697 0.3771104 0.3758867 0.3868844 0.3954810
##      MCI        NA        NA        NA        NA       NaN        NA        NA
##      CTL 0.3566807 0.3720598 0.3863418 0.3992158 0.3991678 0.4094520 0.4280006
##       Max.         SD NAs
##  0.4411069 0.01856467   0
##  0.4034812 0.01439800   0
##         NA         NA   0
##  0.4411069 0.01704522   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.38 0.38    0.38   0.39 0.39    0.39 0.39 0.40 0.00   0
##              AUC_b  0.72 0.79    0.82   0.85 0.85    0.87 0.91 0.94 0.04   0
##            AUC_oob  0.65 0.76    0.82   0.85 0.85    0.88 0.92 0.99 0.05   0
##    sum_sens_spec_b  1.17 1.36    1.45   1.51 1.51    1.57 1.66 1.84 0.09   0
##  sum_sens_spec_oob  0.94 1.23    1.37   1.47 1.46    1.55 1.67 1.83 0.13   0
##              acc_b  0.59 0.64    0.69   0.74 0.74    0.79 0.86 0.94 0.07   0
##            acc_oob  0.52 0.62    0.68   0.73 0.73    0.78 0.83 0.92 0.07   0
##      sensitivity_b  0.52 0.64    0.73   0.77 0.77    0.83 0.90 1.00 0.08   0
##    sensitivity_oob  0.10 0.43    0.60   0.75 0.73    0.88 1.00 1.00 0.18   0
##      specificity_b  0.55 0.62    0.68   0.73 0.74    0.79 0.88 0.96 0.08   0
##    specificity_oob  0.47 0.58    0.66   0.72 0.73    0.80 0.89 0.98 0.09   0
##     cohens_kappa_b  0.09 0.19    0.27   0.33 0.34    0.40 0.53 0.73 0.10   0
##   cohens_kappa_oob -0.04 0.14    0.22   0.29 0.29    0.35 0.45 0.59 0.09   0
write.csv(cpT$data, "datafig2c_AD.csv")

cpT_MCI <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
       logAvgThickness,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT_MCI)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.6403 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            0.3978        1.1841 0.5694      0.6452       0.539 40 22 71 83
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.3516182 0.3687439 0.3850786 0.3971972 0.3966299 0.4074702 0.4259685
##       AD        NA        NA        NA        NA       NaN        NA        NA
##      MCI 0.3516182 0.3672800 0.3797841 0.3900228 0.3903262 0.4006382 0.4151921
##      CTL 0.3566807 0.3720598 0.3863418 0.3992158 0.3991678 0.4094520 0.4280006
##       Max.         SD NAs
##  0.4411069 0.01707448   0
##         NA         NA   0
##  0.4220982 0.01556185   0
##  0.4411069 0.01704522   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.38 0.39    0.39   0.40 0.40    0.40 0.40 0.41 0.00   0
##              AUC_b  0.50 0.57    0.62   0.64 0.64    0.67 0.71 0.78 0.04   0
##            AUC_oob  0.46 0.55    0.60   0.64 0.64    0.68 0.73 0.81 0.05   0
##    sum_sens_spec_b  0.94 1.08    1.15   1.20 1.20    1.26 1.33 1.43 0.08   0
##  sum_sens_spec_oob  0.90 1.01    1.10   1.16 1.16    1.23 1.32 1.48 0.10   0
##              acc_b  0.39 0.48    0.54   0.59 0.58    0.63 0.68 0.74 0.06   0
##            acc_oob  0.36 0.46    0.53   0.57 0.57    0.61 0.66 0.73 0.06   0
##      sensitivity_b  0.34 0.49    0.58   0.64 0.64    0.71 0.82 0.94 0.10   0
##    sensitivity_oob  0.15 0.38    0.52   0.61 0.61    0.71 0.86 1.00 0.15   0
##      specificity_b  0.19 0.36    0.49   0.57 0.56    0.64 0.74 0.84 0.11   0
##    specificity_oob  0.12 0.34    0.47   0.56 0.55    0.63 0.73 0.92 0.12   0
##     cohens_kappa_b -0.04 0.06    0.12   0.17 0.17    0.22 0.29 0.39 0.07   0
##   cohens_kappa_oob -0.08 0.00    0.08   0.13 0.13    0.19 0.27 0.40 0.08   0
write.csv(cpT_MCI$data, "datafig2c_MCI.csv")
roc_T_AD <- cpT$roc_curve[[1]]
roc_T_MCI <- cpT_MCI$roc_curve[[1]]

write.csv(cpT$roc_curve[[1]], "datafig2a_rocAD_T.csv")
write.csv(cpT_MCI$roc_curve[[1]], "datafig2a_rocMCI_T.csv")
lab1 = paste("AD: ACC=", signif(cpK$acc,2),"\nSENS=",signif(cpK$sensitivity,2),"\nSPEC=",signif(cpK$specificity,2),"\nMCI: ACC=", signif(cpK_MCI$acc,2),"\nSENS=",signif(cpK_MCI$sensitivity,2),"\nSPEC=",signif(cpK_MCI$specificity,2))

xrng1 <- range(dados_hemi_v1$K)

cutpoint_a <- ggplot(dados_hemi_v1, aes(x = K, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
    geom_density() +
    geom_vline(xintercept = cpK$optimal_cutpoint, linetype = "dashed") + 
    geom_vline(xintercept = cpK_MCI$optimal_cutpoint, linetype = "dotted") + 
    theme_pubr() +
    guides(alpha = "none") +
    labs(y = "Density") +
    theme(axis.title = element_text(size = 11),
          axis.text = element_text(size = 10), text = element_text(size = 10)) +
    scale_x_continuous(
        labels = scales::number_format(accuracy = 0.01), limits=c(-0.59,-0.46), breaks = c(-0.58, -0.55, -0.52, -0.49)) +
    scale_fill_manual(values=cbbPalette2) +
    scale_colour_manual(values=cbbPalette2)
# +
#     annotate("text", x = xrng1[1], y = Inf, vjust = 1.1, hjust = 0.95,label = lab1, size = 2)

lab2 = paste("AD: ACC=", signif(cpT$acc,2),"\nSENS=",signif(cpT$sensitivity,2),"\nSPEC=",signif(cpT$specificity,2),"\nMCI: ACC=", signif(cpT_MCI$acc,2),"\nSENS=",signif(cpT_MCI$sensitivity,2),"\nSPEC=",signif(cpT_MCI$specificity,2))

xrng2 <- range(dados_hemi_v1$logAvgThickness)

cutpoint_b <- ggplot(dados_hemi_v1, aes(x = logAvgThickness, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
    geom_density() +
    geom_vline(xintercept = cpT$optimal_cutpoint, linetype = "dashed") + 
    geom_vline(xintercept = cpT_MCI$optimal_cutpoint, linetype = "dotted") + 
    theme_pubr() +
    guides(alpha = "none") +
    theme(axis.title = element_text(size = 11),
          axis.text = element_text(size = 10), text = element_text(size = 10), legend.position = "none") +
    labs(x = expression('log'[10]*'T'), y = "Density") +
 scale_x_continuous(limits=c(0.32,0.48), n.breaks = 4) +
    scale_fill_manual(values=cbbPalette2) +
    scale_colour_manual(values=cbbPalette2)
# +
#     annotate("text", x = xrng2[1], y = Inf, vjust = 1.1, hjust = 0.95, label = lab2, size = 2)
# cutpoint_b

fig_cutpoint <- ggarrange(cutpoint_a, cutpoint_b, labels = c("A", "B"),  ncol = 1, font.label = list(size = 11), common.legend = TRUE, legend = "top")

5.4.5.3 GI

cpGI <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
       localGI,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI)
## Method: maximize_boot_metric 
## Predictor: localGI 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.7008 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##            2.5805        1.3741 0.6833      0.6923      0.6818 18  8 49 105
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.380713 2.491836 2.551500 2.612425 2.614738 2.674556 2.764586
##       AD 2.380713 2.401685 2.516433 2.554999 2.556980 2.610559 2.702224
##      MCI       NA       NA       NA       NA      NaN       NA       NA
##      CTL 2.419221 2.506121 2.561112 2.620543 2.624489 2.679626 2.773118
##      Max.         SD NAs
##  2.837762 0.08616113   0
##  2.713507 0.08880478   0
##        NA         NA   0
##  2.837762 0.08206137   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.49 2.55    2.57   2.58 2.58    2.59 2.61 2.67 0.02   0
##              AUC_b  0.49 0.60    0.66   0.70 0.70    0.74 0.79 0.88 0.06   0
##            AUC_oob  0.38 0.57    0.65   0.70 0.70    0.75 0.83 0.92 0.08   0
##    sum_sens_spec_b  0.77 1.14    1.28   1.35 1.35    1.42 1.51 1.62 0.11   0
##  sum_sens_spec_oob  0.83 1.06    1.21   1.31 1.30    1.40 1.54 1.76 0.15   0
##              acc_b  0.32 0.58    0.66   0.69 0.69    0.73 0.78 0.89 0.07   0
##            acc_oob  0.38 0.56    0.64   0.68 0.67    0.71 0.77 0.89 0.07   0
##      sensitivity_b  0.19 0.48    0.60   0.66 0.65    0.72 0.80 0.94 0.10   0
##    sensitivity_oob  0.00 0.33    0.50   0.62 0.62    0.75 0.88 1.00 0.17   0
##      specificity_b  0.26 0.56    0.65   0.70 0.69    0.74 0.80 0.99 0.08   0
##    specificity_oob  0.29 0.53    0.64   0.69 0.68    0.74 0.81 0.97 0.09   0
##     cohens_kappa_b -0.07 0.08    0.17   0.22 0.22    0.28 0.35 0.45 0.08   0
##   cohens_kappa_oob -0.12 0.04    0.13   0.19 0.19    0.25 0.33 0.48 0.09   0
cpGI_MCI <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
       localGI,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI_MCI)
## Method: maximize_boot_metric 
## Predictor: localGI 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5782 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            2.6258        1.1902 0.5463      0.7097      0.4805 44 18 80 74
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.419221 2.510932 2.558535 2.609695 2.618887 2.670658 2.765666
##       AD       NA       NA       NA       NA      NaN       NA       NA
##      MCI 2.507896 2.532143 2.558255 2.590824 2.604971 2.627853 2.741349
##      CTL 2.419221 2.506121 2.561112 2.620543 2.624489 2.679626 2.773118
##      Max.         SD NAs
##  2.837762 0.07787729   0
##        NA         NA   0
##  2.779485 0.06488261   0
##  2.837762 0.08206137   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.59 2.61    2.62   2.62 2.62    2.63 2.64 2.70 0.01   0
##              AUC_b  0.45 0.51    0.55   0.58 0.58    0.61 0.65 0.70 0.04   0
##            AUC_oob  0.38 0.49    0.54   0.58 0.58    0.62 0.67 0.76 0.06   0
##    sum_sens_spec_b  0.93 1.09    1.17   1.22 1.21    1.26 1.33 1.44 0.07   0
##  sum_sens_spec_oob  0.83 1.00    1.11   1.17 1.17    1.24 1.33 1.50 0.10   0
##              acc_b  0.29 0.48    0.53   0.56 0.56    0.59 0.63 0.69 0.05   0
##            acc_oob  0.39 0.46    0.51   0.54 0.54    0.57 0.62 0.68 0.05   0
##      sensitivity_b  0.44 0.59    0.68   0.73 0.72    0.77 0.83 0.91 0.07   0
##    sensitivity_oob  0.32 0.50    0.62   0.70 0.69    0.77 0.87 1.00 0.12   0
##      specificity_b  0.14 0.37    0.45   0.50 0.49    0.54 0.60 0.67 0.07   0
##    specificity_oob  0.21 0.35    0.43   0.48 0.48    0.53 0.60 0.77 0.08   0
##     cohens_kappa_b -0.04 0.06    0.13   0.17 0.17    0.21 0.26 0.37 0.06   0
##   cohens_kappa_oob -0.14 0.00    0.08   0.13 0.13    0.18 0.26 0.36 0.08   0

5.4.5.4 Deaged

5.4.5.4.1 K
cpK_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK_deaged)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.7852 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.5201        1.3696 0.7889      0.5385      0.8312 14 12 26 128
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5423463 -0.5317798 -0.5170820 -0.5061175 -0.5082363 -0.4987331
##       AD -0.5423463 -0.5397941 -0.5315661 -0.5261094 -0.5207321 -0.5064586
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.5324581 -0.5259456 -0.5149816 -0.5051845 -0.5061266 -0.4980014
##         95%       Max.         SD NAs
##  -0.4887326 -0.4795903 0.01320578   0
##  -0.5032434 -0.5026811 0.01356594   0
##          NA         NA         NA   0
##  -0.4878314 -0.4795903 0.01195587   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.53 -0.53   -0.52  -0.52 -0.52   -0.51 -0.51 -0.50 0.01
##              AUC_b  0.60  0.70    0.75   0.78  0.78    0.82  0.86  0.93 0.05
##            AUC_oob  0.48  0.67    0.74   0.79  0.79    0.84  0.90  1.00 0.07
##    sum_sens_spec_b  0.90  1.15    1.28   1.39  1.39    1.50  1.63  1.83 0.15
##  sum_sens_spec_oob  0.91  1.14    1.27   1.36  1.36    1.44  1.56  1.82 0.13
##              acc_b  0.42  0.56    0.68   0.78  0.76    0.85  0.91  0.96 0.11
##            acc_oob  0.42  0.54    0.68   0.78  0.75    0.83  0.89  0.95 0.11
##      sensitivity_b  0.36  0.48    0.54   0.59  0.60    0.65  0.76  1.00 0.09
##    sensitivity_oob  0.00  0.29    0.44   0.56  0.58    0.69  0.90  1.00 0.18
##      specificity_b  0.40  0.53    0.70   0.82  0.79    0.89  0.95  0.99 0.13
##    specificity_oob  0.36  0.49    0.69   0.81  0.78    0.90  0.96  1.00 0.14
##     cohens_kappa_b -0.05  0.08    0.17   0.30  0.32    0.46  0.62  0.79 0.18
##   cohens_kappa_oob -0.08  0.09    0.19   0.27  0.28    0.36  0.49  0.77 0.12
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
# plot(cpK)

write.csv(cpK_deaged$data, "datafig2b_AD.csv")


cpK_MCI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK_MCI_deaged)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5693 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##           -0.5082        1.1167 0.5694      0.5323      0.5844 33 29 64 90
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.5385238 -0.5271938 -0.5157804 -0.5059702 -0.5070010 -0.4981933
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.5385238 -0.5290533 -0.5167194 -0.5104862 -0.5091730 -0.5004693
##      CTL -0.5324581 -0.5259456 -0.5149816 -0.5051845 -0.5061266 -0.4980014
##         95%       Max.         SD NAs
##  -0.4885254 -0.4795903 0.01218702   0
##          NA         NA         NA   0
##  -0.4890858 -0.4849284 0.01257898   0
##  -0.4878314 -0.4795903 0.01195587   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.52 -0.52   -0.51  -0.51 -0.51   -0.51 -0.50 -0.50 0.00
##              AUC_b  0.43  0.49    0.54   0.57  0.57    0.60  0.64  0.70 0.04
##            AUC_oob  0.41  0.48    0.53   0.57  0.57    0.61  0.67  0.76 0.06
##    sum_sens_spec_b  0.89  1.01    1.08   1.14  1.14    1.20  1.29  1.42 0.09
##  sum_sens_spec_oob  0.81  0.94    1.04   1.11  1.11    1.18  1.27  1.40 0.10
##              acc_b  0.36  0.50    0.56   0.59  0.59    0.63  0.68  0.74 0.05
##            acc_oob  0.37  0.47    0.54   0.58  0.58    0.62  0.67  0.75 0.06
##      sensitivity_b  0.13  0.31    0.46   0.53  0.52    0.59  0.71  0.85 0.11
##    sensitivity_oob  0.09  0.27    0.43   0.50  0.50    0.59  0.71  0.86 0.13
##      specificity_b  0.21  0.45    0.55   0.63  0.62    0.69  0.77  0.94 0.10
##    specificity_oob  0.23  0.42    0.54   0.62  0.61    0.69  0.78  0.89 0.11
##     cohens_kappa_b -0.10  0.01    0.07   0.13  0.13    0.17  0.26  0.39 0.08
##   cohens_kappa_oob -0.17 -0.05    0.03   0.10  0.10    0.16  0.24  0.39 0.09
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
# plot(cpK_MCI)


write.csv(cpK_MCI_deaged$data, "datafig2b_MCI.csv")
5.4.5.4.2 log Avg Thickness
cpT_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
       logAvgThickness_age_decay,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT_deaged)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.7248 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##             0.423        1.2727 0.7333         0.5      0.7727 13 13 35 119
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.3915353 0.4087752 0.4227995 0.4301048 0.4318351 0.4421783 0.4588600
##       AD 0.3915353 0.4010329 0.4116461 0.4226828 0.4214529 0.4291104 0.4418508
##      MCI        NA        NA        NA        NA       NaN        NA        NA
##      CTL 0.4001589 0.4134574 0.4238657 0.4314060 0.4335880 0.4435058 0.4590177
##       Max.         SD NAs
##  0.4628195 0.01460961   0
##  0.4468100 0.01378867   0
##         NA         NA   0
##  0.4628195 0.01404404   0
## 
## Bootstrap summary: 
##           Variable  Min.   5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.41 0.42    0.42   0.42 0.42    0.43 0.43 0.44 0.00   0
##              AUC_b  0.48 0.63    0.69   0.73 0.73    0.76 0.81 0.88 0.06   0
##            AUC_oob  0.45 0.59    0.67   0.72 0.72    0.77 0.85 0.93 0.08   0
##    sum_sens_spec_b  0.93 1.15    1.28   1.35 1.34    1.41 1.52 1.63 0.11   0
##  sum_sens_spec_oob  0.83 1.02    1.17   1.27 1.26    1.36 1.51 1.74 0.14   0
##              acc_b  0.32 0.55    0.66   0.72 0.71    0.78 0.84 0.92 0.09   0
##            acc_oob  0.31 0.54    0.64   0.71 0.70    0.76 0.82 0.90 0.09   0
##      sensitivity_b  0.32 0.44    0.54   0.61 0.61    0.68 0.79 0.94 0.11   0
##    sensitivity_oob  0.00 0.22    0.40   0.54 0.54    0.69 0.89 1.00 0.20   0
##      specificity_b  0.28 0.52    0.66   0.74 0.73    0.82 0.89 0.95 0.11   0
##    specificity_oob  0.22 0.50    0.65   0.73 0.72    0.82 0.89 0.96 0.12   0
##     cohens_kappa_b -0.03 0.08    0.17   0.24 0.24    0.30 0.41 0.60 0.10   0
##   cohens_kappa_oob -0.15 0.01    0.11   0.17 0.18    0.24 0.35 0.56 0.10   0
write.csv(cpT_deaged$data, "datafig2d_AD.csv")

cpT_MCI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
       logAvgThickness_age_decay,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpT_MCI_deaged)
## Method: maximize_boot_metric 
## Predictor: logAvgThickness_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5538 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            0.4345        1.0157 0.4769      0.5806      0.4351 36 26 87 67
## 
## Predictor summary: 
##     Data      Min.        5%   1st Qu.    Median      Mean   3rd Qu.       95%
##  Overall 0.4001589 0.4122778 0.4229958 0.4308261 0.4327482 0.4431223 0.4573704
##       AD        NA        NA        NA        NA       NaN        NA        NA
##      MCI 0.4024658 0.4095831 0.4206394 0.4292656 0.4306624 0.4413764 0.4493808
##      CTL 0.4001589 0.4134574 0.4238657 0.4314060 0.4335880 0.4435058 0.4590177
##       Max.         SD NAs
##  0.4628195 0.01370884   0
##         NA         NA   0
##  0.4557856 0.01270739   0
##  0.4628195 0.01404404   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  0.42  0.42    0.43   0.43 0.43    0.44 0.45 0.45 0.01   0
##              AUC_b  0.40  0.48    0.53   0.56 0.56    0.59 0.63 0.68 0.05   0
##            AUC_oob  0.38  0.45    0.51   0.55 0.55    0.59 0.65 0.76 0.06   0
##    sum_sens_spec_b  0.75  0.92    1.01   1.08 1.08    1.15 1.24 1.33 0.10   0
##  sum_sens_spec_oob  0.70  0.87    0.96   1.03 1.02    1.09 1.18 1.32 0.10   0
##              acc_b  0.31  0.38    0.43   0.50 0.51    0.59 0.67 0.74 0.10   0
##            acc_oob  0.27  0.36    0.42   0.49 0.49    0.56 0.62 0.69 0.08   0
##      sensitivity_b  0.31  0.43    0.51   0.57 0.60    0.68 0.88 1.00 0.13   0
##    sensitivity_oob  0.10  0.28    0.43   0.55 0.57    0.71 0.91 1.00 0.19   0
##      specificity_b  0.09  0.21    0.32   0.47 0.47    0.62 0.75 0.91 0.17   0
##    specificity_oob  0.05  0.18    0.31   0.46 0.46    0.61 0.72 0.85 0.17   0
##     cohens_kappa_b -0.19 -0.06    0.00   0.06 0.07    0.12 0.23 0.35 0.09   0
##   cohens_kappa_oob -0.24 -0.11   -0.03   0.02 0.02    0.07 0.15 0.29 0.08   0
write.csv(cpT_MCI_deaged$data, "datafig2d_MCI.csv")
5.4.5.4.3 GI
cpGI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
        localGI_age_decay,
        Diagnostic,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI_deaged)
## Method: maximize_boot_metric 
## Predictor: localGI_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.6476 180    26   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            2.6673        1.2577 0.6111      0.6538      0.6039 17  9 61 93
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.511402 2.577661 2.633063 2.681774 2.687612 2.738753 2.807036
##       AD 2.515421 2.519055 2.620142 2.654242 2.651294 2.693528 2.772357
##      MCI       NA       NA       NA       NA      NaN       NA       NA
##      CTL 2.511402 2.591092 2.637065 2.692298 2.693743 2.740771 2.822236
##      Max.         SD NAs
##  2.872972 0.07434917   0
##  2.778640 0.07489024   0
##        NA         NA   0
##  2.872972 0.07272383   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.60  2.63    2.66   2.67 2.67    2.68 2.70 2.75 0.02   0
##              AUC_b  0.42  0.55    0.61   0.65 0.65    0.69 0.74 0.84 0.06   0
##            AUC_oob  0.27  0.51    0.59   0.65 0.65    0.71 0.78 0.92 0.08   0
##    sum_sens_spec_b  0.86  1.05    1.17   1.23 1.24    1.31 1.43 1.64 0.11   0
##  sum_sens_spec_oob  0.60  0.93    1.09   1.19 1.19    1.29 1.43 1.73 0.15   0
##              acc_b  0.23  0.47    0.57   0.63 0.62    0.67 0.74 0.85 0.09   0
##            acc_oob  0.32  0.46    0.55   0.61 0.60    0.66 0.74 0.84 0.08   0
##      sensitivity_b  0.23  0.38    0.55   0.64 0.62    0.70 0.79 0.91 0.13   0
##    sensitivity_oob  0.00  0.20    0.44   0.60 0.58    0.73 0.88 1.00 0.21   0
##      specificity_b  0.17  0.44    0.55   0.62 0.62    0.69 0.79 0.95 0.11   0
##    specificity_oob  0.20  0.42    0.54   0.61 0.61    0.68 0.80 0.94 0.12   0
##     cohens_kappa_b -0.06  0.03    0.09   0.13 0.14    0.18 0.26 0.41 0.07   0
##   cohens_kappa_oob -0.21 -0.04    0.05   0.10 0.10    0.16 0.24 0.38 0.09   0
# plot(cpK)

cpGI_MCI_deaged <-
    cutpointr(
        filter(dados_hemi_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
        localGI_age_decay,
        Diagnostic,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpGI_MCI_deaged)
## Method: maximize_boot_metric 
## Predictor: localGI_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Nr. of bootstraps: 1000 
## 
##     AUC   n n_pos n_neg
##  0.5334 216    62   154
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp tn
##            2.7054        1.1736 0.5139      0.7581      0.4156 47 15 90 64
## 
## Predictor summary: 
##     Data     Min.       5%  1st Qu.   Median     Mean  3rd Qu.      95%
##  Overall 2.511402 2.598801 2.642303 2.685176 2.691592 2.735631 2.812225
##       AD       NA       NA       NA       NA      NaN       NA       NA
##      MCI 2.595836 2.609992 2.645187 2.673114 2.686248 2.702904 2.807338
##      CTL 2.511402 2.591092 2.637065 2.692298 2.693743 2.740771 2.822236
##      Max.         SD NAs
##  2.872972 0.06892145   0
##        NA         NA   0
##  2.835621 0.05862119   0
##  2.872972 0.07272383   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median Mean 3rd Qu.  95% Max.   SD NAs
##   optimal_cutpoint  2.66  2.69    2.70   2.70 2.71    2.71 2.73 2.79 0.01   0
##              AUC_b  0.39  0.47    0.50   0.53 0.53    0.56 0.60 0.67 0.04   0
##            AUC_oob  0.35  0.44    0.50   0.53 0.53    0.57 0.62 0.70 0.06   0
##    sum_sens_spec_b  0.88  1.01    1.10   1.16 1.15    1.22 1.29 1.39 0.09   0
##  sum_sens_spec_oob  0.77  0.95    1.07   1.13 1.12    1.19 1.27 1.40 0.10   0
##              acc_b  0.28  0.40    0.48   0.52 0.51    0.55 0.59 0.65 0.06   0
##            acc_oob  0.35  0.42    0.47   0.49 0.50    0.53 0.58 0.63 0.05   0
##      sensitivity_b  0.46  0.60    0.69   0.74 0.73    0.78 0.84 0.90 0.07   0
##    sensitivity_oob  0.17  0.50    0.63   0.72 0.71    0.80 0.89 1.00 0.12   0
##      specificity_b  0.12  0.27    0.38   0.43 0.42    0.48 0.55 0.70 0.09   0
##    specificity_oob  0.14  0.28    0.36   0.41 0.41    0.46 0.54 0.70 0.08   0
##     cohens_kappa_b -0.08  0.00    0.07   0.12 0.12    0.16 0.22 0.31 0.07   0
##   cohens_kappa_oob -0.22 -0.04    0.05   0.09 0.09    0.14 0.20 0.30 0.07   0
# plot(cpK_MCI)
lab3 = paste("AD: ACC=", signif(cpK_deaged$acc,2),"\nSENS=",signif(cpK_deaged$sensitivity,2),"\nSPEC=",signif(cpK_deaged$specificity,2),"\nMCI: ACC=", signif(cpK_MCI_deaged$acc,2),"\nSENS=",signif(cpK_MCI_deaged$sensitivity,2),"\nSPEC=",signif(cpK_MCI_deaged$specificity,2))

cutpoint_a_deaged <- ggplot(dados_hemi_v1, aes(x = K_age_decay, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
  geom_density() +
  geom_vline(data = cpK_deaged, aes(xintercept = optimal_cutpoint), linetype = "dashed") + 
    geom_vline(data = cpK_MCI_deaged, aes(xintercept = optimal_cutpoint), linetype = "dotted") + 
  theme_pubr() +
  guides(alpha = "none", linetype = "none") +
  theme(axis.title = element_text(size = 11),
    axis.text = element_text(size = 10), text = element_text(size = 10)) +
  labs(x = "K (After age correction)", y = "Density") +
  scale_x_continuous(
              labels = scales::number_format(accuracy = 0.01), limits=c(-0.59,-0.46), breaks = c(-0.58, -0.55, -0.52, -0.49)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
# +
#     annotate("text", x = xrng1[1], y = Inf, vjust = 1.1, hjust = 0.95, label = lab3, size = 2)
# cutpoint_a_deaged

lab4 = paste("AD: ACC=", signif(cpT_deaged$acc,2),"\nSENS=",signif(cpT_deaged$sensitivity,2),"\nSPEC=",signif(cpT_deaged$specificity,2),"\nMCI: ACC=", signif(cpT_MCI_deaged$acc,2),"\nSENS=",signif(cpT_MCI_deaged$sensitivity,2),"\nSPEC=",signif(cpT_MCI_deaged$specificity,2))

cutpoint_b_deaged <- ggplot(dados_hemi_v1, aes(x = logAvgThickness_age_decay, color = Diagnostic, fill = Diagnostic, alpha = 0.4))+
  geom_density() +
  geom_vline(data = cpT_deaged, aes(xintercept = optimal_cutpoint), linetype = "dashed") + 
  geom_vline(data = cpT_MCI_deaged, aes(xintercept = optimal_cutpoint), linetype = "dotted") + 
  theme_pubr() +
  guides(alpha = "none", linetype = "none") +
  theme(axis.title = element_text(size = 11),
    axis.text = element_text(size = 10), text = element_text(size = 10), legend.position = "none") +
  labs(x = expression('log'[10]*'T '*('After age correction')), y = "Density") +
  scale_x_continuous(limits=c(0.32,0.48), n.breaks = 4) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)
# +
# annotate("text", x = xrng2[1], y = Inf, vjust = 1.1, hjust = 0.95, label = lab4, size = 2)

5.4.6 data sharing - FIGURE 2

datafig2 <- dados_hemi_v1 %>%
  dplyr::select(c(Age, Diagnostic, AvgThickness, TotalArea, ExposedArea, K)) %>%
  mutate(x = log10(ExposedArea),
         y = log10(sqrt(AvgThickness) * TotalArea)) %>%
  dplyr::select(c(Age, Diagnostic, x, y, K))
write.csv(datafig1, "datafig1.csv")

FIGURE 2

fig_cutpoint_deaged_alt <- ggarrange(cutpoint_a, cutpoint_b, cutpoint_a_deaged,  cutpoint_b_deaged, labels = c("A", "B", "C", "D"),  ncol = 2, nrow = 2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom") + 
  theme(plot.background = element_rect(fill="white", color = NA))

ggsave("Figure2_nocomments.png", plot = fig_cutpoint_deaged_alt, width = 18, height = 11, units = "cm", device = "png")
<<<<<<< HEAD
ggsave("Figure2_nocomments.pdf", plot = fig_cutpoint_deaged_alt, width = 18, height = 11, units = "cm", device = "pdf")

=======
>>>>>>> 4d9cecbc0c825eb7d0bbaf2d56d55f2bd1ec1bdf
# ggsave("fig_cutpoint_deaged_alt.pdf", plot = fig_cutpoint_deaged_alt, dpi=1200, width = 9, height = 22, units = "cm", device = "pdf")
fig_cutpoint_deaged_alt
\label{fig:figure2}Optimal cut-off (maximum sensitivity + specificity) for K and Average Cortical Thickness including results with removed age effect (age correction). AD in red (N = 13), MCI in green (N = 33), and Cognitive Unimpaired Controls (CTL) in blue (N = 77). The dashed line represents optimal cut-off to discriminate AD and CTL, and the dotted line represents optimal cut-off to discriminate MCI and CTL. ACC - accuracy, SPEC - specificity, and SENS - sensibility. (A) The optimal cut-off for the CTL-AD contrast is -0.54 and CTL-MCI, -0.53. (B) The optimal cut-off for CTL-AD = -0.52 and CTL-MCI = -0.51. (C) The optimal cut-off for CTL-AD = 0.39 mm and CTL-MCI = 0.40 mm. (D) The optimal cut-off for CTL-AD = 0.43 mm and CTL-MCI = 0.44 mm.

Optimal cut-off (maximum sensitivity + specificity) for K and Average Cortical Thickness including results with removed age effect (age correction). AD in red (N = 13), MCI in green (N = 33), and Cognitive Unimpaired Controls (CTL) in blue (N = 77). The dashed line represents optimal cut-off to discriminate AD and CTL, and the dotted line represents optimal cut-off to discriminate MCI and CTL. ACC - accuracy, SPEC - specificity, and SENS - sensibility. (A) The optimal cut-off for the CTL-AD contrast is -0.54 and CTL-MCI, -0.53. (B) The optimal cut-off for CTL-AD = -0.52 and CTL-MCI = -0.51. (C) The optimal cut-off for CTL-AD = 0.39 mm and CTL-MCI = 0.40 mm. (D) The optimal cut-off for CTL-AD = 0.43 mm and CTL-MCI = 0.44 mm.

5.4.6.1 Lobes (age corrected)

Table 1

cpK <-
    cutpointr(
        filter(dados_lobos_v1, Diagnostic == "AD" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        ROI,
        pos_class = "AD",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Subgroups: F, P, T, O 
## Nr. of bootstraps: 1000 
## 
## Subgroup: F 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.6994 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.4614         1.243 0.7345      0.4615      0.7815 12 14 33 118
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.4924472 -0.4777872 -0.4618779 -0.4493759 -0.4504447 -0.4382565
##       AD -0.4924472 -0.4858975 -0.4771550 -0.4608831 -0.4613222 -0.4447041
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.4889670 -0.4736635 -0.4585019 -0.4487091 -0.4485717 -0.4360336
##         95%       Max.         SD NAs
##  -0.4272281 -0.4191747 0.01623795   0
##  -0.4359569 -0.4332498 0.01813598   0
##          NA         NA         NA   0
##  -0.4264298 -0.4191747 0.01518272   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.48 -0.47   -0.47  -0.46 -0.46   -0.46 -0.45 -0.43 0.01
##              AUC_b  0.46  0.60    0.66   0.70  0.70    0.74  0.79  0.88 0.06
##            AUC_oob  0.44  0.56    0.65   0.70  0.70    0.76  0.83  0.99 0.08
##    sum_sens_spec_b  0.73  1.11    1.22   1.30  1.29    1.37  1.48  1.64 0.12
##  sum_sens_spec_oob  0.83  1.02    1.15   1.24  1.24    1.33  1.46  1.89 0.14
##              acc_b  0.31  0.55    0.70   0.75  0.74    0.79  0.86  0.94 0.09
##            acc_oob  0.34  0.55    0.68   0.74  0.72    0.78  0.84  0.94 0.09
##      sensitivity_b  0.25  0.37    0.44   0.52  0.52    0.59  0.70  1.00 0.10
##    sensitivity_oob  0.00  0.20    0.36   0.45  0.48    0.60  0.80  1.00 0.18
##      specificity_b  0.25  0.54    0.73   0.79  0.77    0.84  0.92  0.99 0.11
##    specificity_oob  0.15  0.51    0.71   0.79  0.76    0.84  0.93  1.00 0.12
##     cohens_kappa_b -0.10  0.06    0.15   0.23  0.23    0.30  0.44  0.68 0.11
##   cohens_kappa_oob -0.13  0.01    0.11   0.18  0.18    0.25  0.36  0.61 0.11
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: P 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.7858 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##            -0.337        1.4845 0.7232      0.7692      0.7152 20  6 43 108
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3887231 -0.3609292 -0.3417547 -0.3303306 -0.3324749 -0.3209917
##       AD -0.3673445 -0.3645357 -0.3577182 -0.3451577 -0.3459457 -0.3386622
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.3887231 -0.3595692 -0.3382488 -0.3285399 -0.3301554 -0.3194001
##         95%       Max.         SD NAs
##  -0.3093390 -0.2967149 0.01692941   0
##  -0.3260820 -0.3201238 0.01326828   0
##          NA         NA         NA   0
##  -0.3082498 -0.2967149 0.01643388   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.35 -0.34   -0.34  -0.34 -0.34   -0.34 -0.33 -0.33 0.00
##              AUC_b  0.62  0.71    0.76   0.79  0.78    0.81  0.85  0.90 0.04
##            AUC_oob  0.54  0.69    0.75   0.79  0.79    0.83  0.89  0.96 0.06
##    sum_sens_spec_b  1.12  1.30    1.40   1.47  1.47    1.54  1.64  1.77 0.10
##  sum_sens_spec_oob  0.87  1.19    1.35   1.45  1.44    1.54  1.65  1.82 0.14
##              acc_b  0.47  0.63    0.69   0.73  0.73    0.77  0.81  0.89 0.06
##            acc_oob  0.49  0.61    0.68   0.72  0.72    0.76  0.81  0.87 0.06
##      sensitivity_b  0.41  0.59    0.69   0.75  0.74    0.81  0.88  0.96 0.09
##    sensitivity_oob  0.11  0.40    0.62   0.75  0.72    0.83  1.00  1.00 0.17
##      specificity_b  0.41  0.61    0.68   0.73  0.72    0.77  0.82  0.94 0.07
##    specificity_oob  0.38  0.58    0.67   0.72  0.72    0.77  0.84  0.94 0.08
##     cohens_kappa_b  0.06  0.16    0.25   0.30  0.31    0.37  0.45  0.59 0.09
##   cohens_kappa_oob -0.11  0.12    0.21   0.27  0.27    0.34  0.43  0.56 0.10
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: T 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.7504 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.3421        1.2975 0.6723      0.6154      0.6821 16 10 48 103
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3862226 -0.3693890 -0.3449413 -0.3362110 -0.3372773 -0.3269770
##       AD -0.3862226 -0.3793668 -0.3651671 -0.3476139 -0.3513326 -0.3366410
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.3723159 -0.3605893 -0.3441472 -0.3347947 -0.3348572 -0.3258725
##         95%       Max.         SD NAs
##  -0.3115348 -0.2980570 0.01646089   0
##  -0.3310313 -0.3219632 0.01803107   0
##          NA         NA         NA   0
##  -0.3109501 -0.2980570 0.01495334   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.37 -0.35   -0.35  -0.34 -0.34   -0.34 -0.33 -0.33 0.01
##              AUC_b  0.58  0.66    0.72   0.75  0.75    0.78  0.82  0.90 0.05
##            AUC_oob  0.42  0.64    0.70   0.76  0.75    0.80  0.87  0.99 0.07
##    sum_sens_spec_b  1.01  1.18    1.27   1.34  1.34    1.42  1.51  1.68 0.10
##  sum_sens_spec_oob  0.60  1.04    1.19   1.29  1.28    1.38  1.52  1.88 0.15
##              acc_b  0.40  0.54    0.63   0.69  0.70    0.77  0.84  0.93 0.09
##            acc_oob  0.39  0.51    0.61   0.68  0.68    0.75  0.82  0.90 0.10
##      sensitivity_b  0.31  0.44    0.56   0.64  0.64    0.71  0.83  0.94 0.11
##    sensitivity_oob  0.00  0.25    0.44   0.60  0.59    0.75  0.91  1.00 0.21
##      specificity_b  0.34  0.50    0.62   0.70  0.71    0.81  0.88  0.99 0.12
##    specificity_oob  0.30  0.46    0.60   0.70  0.69    0.80  0.89  1.00 0.14
##     cohens_kappa_b  0.01  0.09    0.16   0.22  0.23    0.30  0.40  0.60 0.10
##   cohens_kappa_oob -0.14  0.03    0.12   0.17  0.18    0.25  0.35  0.64 0.10
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: O 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.6694 177    26   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.3545        1.2682 0.7288         0.5      0.7682 13 13 35 116
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.4071304 -0.3816251 -0.3556343 -0.3413318 -0.3412010 -0.3271589
##       AD -0.4071304 -0.3888987 -0.3758057 -0.3538700 -0.3547200 -0.3347385
##      MCI         NA         NA         NA         NA        NaN         NA
##      CTL -0.3914546 -0.3758727 -0.3531679 -0.3392267 -0.3388732 -0.3262021
##         95%       Max.         SD NAs
##  -0.2999387 -0.2784499 0.02333062   0
##  -0.3130321 -0.3074425 0.02669722   0
##          NA         NA         NA   0
##  -0.2976979 -0.2784499 0.02197141   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.38 -0.37   -0.36  -0.35 -0.35   -0.35 -0.35 -0.33 0.01
##              AUC_b  0.41  0.56    0.62   0.67  0.67    0.71  0.77  0.89 0.07
##            AUC_oob  0.17  0.52    0.61   0.67  0.67    0.73  0.82  0.92 0.09
##    sum_sens_spec_b  0.93  1.12    1.22   1.29  1.29    1.36  1.45  1.71 0.11
##  sum_sens_spec_oob  0.60  1.00    1.13   1.23  1.23    1.32  1.47  1.64 0.15
##              acc_b  0.36  0.63    0.69   0.73  0.73    0.78  0.84  0.93 0.07
##            acc_oob  0.36  0.59    0.67   0.72  0.72    0.77  0.83  0.90 0.08
##      sensitivity_b  0.16  0.32    0.43   0.52  0.52    0.60  0.74  0.90 0.12
##    sensitivity_oob  0.00  0.19    0.33   0.45  0.47    0.60  0.78  0.93 0.18
##      specificity_b  0.31  0.62    0.71   0.77  0.77    0.83  0.91  0.98 0.09
##    specificity_oob  0.24  0.59    0.69   0.76  0.76    0.84  0.92  0.98 0.10
##     cohens_kappa_b -0.02  0.08    0.16   0.21  0.22    0.27  0.38  0.63 0.09
##   cohens_kappa_oob -0.15  0.00    0.09   0.17  0.17    0.24  0.35  0.49 0.11
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
cpK_MCI <-
    cutpointr(
        filter(dados_lobos_v1, Diagnostic == "MCI" | Diagnostic == "CTL"),
        K_age_decay,
        Diagnostic,
        ROI,
        pos_class = "MCI",
        neg_class = "CTL",
        method = maximize_boot_metric,
        metric = sum_sens_spec,
        na.rm = TRUE,
        boot_runs = 1000,
    use_midpoints = TRUE)
summary(cpK_MCI)
## Method: maximize_boot_metric 
## Predictor: K_age_decay 
## Outcome: Diagnostic 
## Direction: <= 
## Subgroups: F, P, T, O 
## Nr. of bootstraps: 1000 
## 
## Subgroup: F 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.5522 212    61   151
## 
##  optimal_cutpoint sum_sens_spec acc sensitivity specificity tp fn fp tn
##           -0.4471        1.0244 0.5       0.541      0.4834 33 28 78 73
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.4889670 -0.4757844 -0.4598181 -0.4485104 -0.4493672 -0.4381553
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.4830813 -0.4761787 -0.4617166 -0.4482128 -0.4513364 -0.4403851
##      CTL -0.4889670 -0.4736635 -0.4585019 -0.4487091 -0.4485717 -0.4360336
##         95%       Max.         SD NAs
##  -0.4271525 -0.4173079 0.01534275   0
##          NA         NA         NA   0
##  -0.4274757 -0.4173079 0.01568441   0
##  -0.4264298 -0.4191747 0.01518272   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.47 -0.46   -0.45  -0.45 -0.45   -0.44 -0.44 -0.43 0.01
##              AUC_b  0.41  0.48    0.52   0.56  0.55    0.58  0.63  0.69 0.04
##            AUC_oob  0.35  0.45    0.51   0.55  0.55    0.59  0.64  0.73 0.06
##    sum_sens_spec_b  0.82  0.94    1.03   1.08  1.08    1.14  1.21  1.33 0.08
##  sum_sens_spec_oob  0.64  0.85    0.96   1.03  1.03    1.10  1.19  1.33 0.10
##              acc_b  0.37  0.43    0.49   0.53  0.54    0.59  0.67  0.73 0.07
##            acc_oob  0.30  0.40    0.46   0.51  0.52    0.58  0.65  0.77 0.08
##      sensitivity_b  0.15  0.29    0.44   0.53  0.54    0.65  0.81  0.95 0.15
##    sensitivity_oob  0.00  0.20    0.38   0.50  0.50    0.63  0.80  1.00 0.18
##      specificity_b  0.16  0.31    0.43   0.52  0.54    0.65  0.79  0.92 0.15
##    specificity_oob  0.16  0.27    0.40   0.52  0.52    0.64  0.81  0.95 0.16
##     cohens_kappa_b -0.17 -0.05    0.02   0.06  0.07    0.11  0.19  0.31 0.07
##   cohens_kappa_oob -0.27 -0.12   -0.03   0.02  0.02    0.08  0.16  0.35 0.09
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: P 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.4668 212    61   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##             -0.34        1.0699 0.6368      0.2951      0.7748 18 43 34 117
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3887231 -0.3603217 -0.3398804 -0.3280799 -0.3297166 -0.3177028
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.3733775 -0.3612115 -0.3437751 -0.3234164 -0.3286303 -0.3134190
##      CTL -0.3887231 -0.3595692 -0.3382488 -0.3285399 -0.3301554 -0.3194001
##         95%       Max.         SD NAs
##  -0.3063437 -0.2866583 0.01747905   0
##          NA         NA         NA   0
##  -0.3031533 -0.2866583 0.01993832   0
##  -0.3082498 -0.2967149 0.01643388   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.36 -0.35   -0.34  -0.34 -0.34   -0.34 -0.33 -0.31 0.01
##              AUC_b  0.31  0.39    0.44   0.47  0.47    0.50  0.55  0.63 0.05
##            AUC_oob  0.23  0.36    0.42   0.46  0.46    0.50  0.57  0.68 0.06
##    sum_sens_spec_b  0.75  0.95    1.04   1.09  1.08    1.13  1.20  1.32 0.08
##  sum_sens_spec_oob  0.79  0.91    0.98   1.04  1.04    1.09  1.17  1.31 0.08
##              acc_b  0.24  0.55    0.62   0.66  0.65    0.68  0.72  0.79 0.06
##            acc_oob  0.28  0.54    0.59   0.63  0.63    0.66  0.71  0.78 0.06
##      sensitivity_b  0.08  0.16    0.24   0.30  0.29    0.35  0.42  0.83 0.08
##    sensitivity_oob  0.00  0.10    0.19   0.25  0.26    0.32  0.45  1.00 0.11
##      specificity_b  0.04  0.64    0.76   0.80  0.79    0.84  0.90  0.95 0.10
##    specificity_oob  0.06  0.63    0.74   0.79  0.78    0.84  0.91  1.00 0.10
##     cohens_kappa_b -0.21 -0.05    0.04   0.09  0.09    0.14  0.21  0.33 0.08
##   cohens_kappa_oob -0.22 -0.09   -0.02   0.04  0.04    0.10  0.18  0.29 0.09
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: T 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.5924 212    61   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn fp  tn
##           -0.3451        1.2112 0.6887      0.4098      0.8013 25 36 30 121
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3801095 -0.3613212 -0.3454849 -0.3362370 -0.3364610 -0.3261235
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.3801095 -0.3672974 -0.3544182 -0.3409346 -0.3404312 -0.3261432
##      CTL -0.3723159 -0.3605893 -0.3441472 -0.3347947 -0.3348572 -0.3258725
##         95%       Max.         SD NAs
##  -0.3110041 -0.2980570 0.01578222   0
##          NA         NA         NA   0
##  -0.3126286 -0.3066956 0.01715873   0
##  -0.3109501 -0.2980570 0.01495334   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.36 -0.35   -0.35  -0.34 -0.34   -0.34 -0.34 -0.33 0.00
##              AUC_b  0.43  0.51    0.56   0.59  0.59    0.63  0.67  0.73 0.05
##            AUC_oob  0.37  0.49    0.55   0.59  0.59    0.63  0.70  0.77 0.06
##    sum_sens_spec_b  0.85  1.07    1.15   1.20  1.20    1.25  1.32  1.47 0.08
##  sum_sens_spec_oob  0.85  0.99    1.08   1.15  1.15    1.22  1.32  1.51 0.10
##              acc_b  0.43  0.58    0.64   0.67  0.67    0.70  0.75  0.80 0.05
##            acc_oob  0.44  0.55    0.61   0.65  0.65    0.69  0.74  0.80 0.06
##      sensitivity_b  0.23  0.29    0.37   0.43  0.44    0.50  0.59  0.71 0.09
##    sensitivity_oob  0.00  0.21    0.32   0.40  0.40    0.48  0.62  0.92 0.12
##      specificity_b  0.39  0.61    0.70   0.77  0.76    0.83  0.88  0.92 0.09
##    specificity_oob  0.26  0.56    0.67   0.76  0.74    0.83  0.88  0.96 0.10
##     cohens_kappa_b -0.11  0.07    0.14   0.19  0.19    0.25  0.33  0.47 0.08
##   cohens_kappa_oob -0.15 -0.01    0.08   0.15  0.15    0.21  0.31  0.48 0.10
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
## 
## Subgroup: O 
## -------------------------------------------------------------------------------- 
##     AUC   n n_pos n_neg
##  0.5638 212    61   151
## 
##  optimal_cutpoint sum_sens_spec    acc sensitivity specificity tp fn  fp tn
##           -0.3309        1.1048 0.4528      0.7869      0.3179 48 13 103 48
## 
## Predictor summary: 
##     Data       Min.         5%    1st Qu.     Median       Mean    3rd Qu.
##  Overall -0.3914546 -0.3737928 -0.3526654 -0.3404060 -0.3401463 -0.3291942
##       AD         NA         NA         NA         NA        NaN         NA
##      MCI -0.3738751 -0.3665170 -0.3516385 -0.3446323 -0.3432977 -0.3340610
##      CTL -0.3914546 -0.3758727 -0.3531679 -0.3392267 -0.3388732 -0.3262021
##         95%       Max.         SD NAs
##  -0.3067105 -0.2784499 0.02028267   0
##          NA         NA         NA   0
##  -0.3155374 -0.3085133 0.01502257   0
##  -0.2976979 -0.2784499 0.02197141   0
## 
## Bootstrap summary: 
##           Variable  Min.    5% 1st Qu. Median  Mean 3rd Qu.   95%  Max.   SD
##   optimal_cutpoint -0.35 -0.34   -0.34  -0.33 -0.33   -0.33 -0.33 -0.31 0.01
##              AUC_b  0.41  0.50    0.54   0.56  0.56    0.59  0.63  0.69 0.04
##            AUC_oob  0.41  0.47    0.53   0.57  0.56    0.60  0.65  0.73 0.05
##    sum_sens_spec_b  0.95  1.03    1.10   1.14  1.15    1.19  1.27  1.39 0.07
##  sum_sens_spec_oob  0.81  0.94    1.03   1.10  1.09    1.15  1.24  1.37 0.09
##              acc_b  0.33  0.41    0.46   0.50  0.50    0.55  0.61  0.69 0.06
##            acc_oob  0.31  0.39    0.44   0.48  0.48    0.52  0.58  0.66 0.06
##      sensitivity_b  0.45  0.58    0.67   0.74  0.74    0.80  0.88  0.98 0.09
##    sensitivity_oob  0.25  0.44    0.59   0.71  0.70    0.81  0.91  1.00 0.15
##      specificity_b  0.11  0.24    0.32   0.40  0.41    0.50  0.60  0.70 0.11
##    specificity_oob  0.08  0.21    0.30   0.38  0.39    0.48  0.59  0.67 0.12
##     cohens_kappa_b -0.03  0.02    0.07   0.10  0.11    0.15  0.22  0.35 0.06
##   cohens_kappa_oob -0.16 -0.05    0.02   0.07  0.07    0.11  0.18  0.29 0.07
##  NAs
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0
##    0

5.4.7 Aging and pathological morphology alterations

Age groups:

dados_hemi_v1_agegroups <- dados_hemi_v1 %>%
  mutate(Age.group = ifelse(
    Age > 75,
    "76-86",
    ifelse((Age < 75 | Age == 75 & Age > 65 | Age == 65),
           "66-75",
           "")))
Diagnostic Age.group N age age_range ESC
AD 66-75 4 69 ± 3.5 63 ; 71 12 ± 2.7
AD 76-86 9 81 ± 2.3 78 ; 86 13 ± 3.2
MCI 66-75 22 70 ± 3 62 ; 74 13 ± 2.5
MCI 76-86 9 78 ± 2.5 75 ; 82 13 ± 2.1
CTL 66-75 67 64 ± 7.7 43 ; 74 15 ± 2
CTL 76-86 10 77 ± 1.4 75 ; 80 14 ± 2.6

5.4.7.1 K

summary(aov(K ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##                       Df  Sum Sq  Mean Sq F value   Pr(>F)    
## Diagnostic             2 0.01123 0.005617  29.179 4.75e-12 ***
## Age.group              1 0.00145 0.001453   7.550  0.00646 ** 
## Diagnostic:Age.group   2 0.00021 0.000103   0.535  0.58615    
## Residuals            236 0.04543 0.000193                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(K ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K ~ Diagnostic * Age.group, data = dados_hemi_v1_agegroups)
## 
## $Diagnostic
##                diff         lwr        upr     p adj
## MCI-AD  0.015513759 0.007867813 0.02315970 0.0000090
## CTL-AD  0.021969964 0.015031528 0.02890840 0.0000000
## CTL-MCI 0.006456205 0.001534189 0.01137822 0.0062478
## 
## $Age.group
##                     diff          lwr          upr     p adj
## 76-86-66-75 -0.005293515 -0.009459874 -0.001127155 0.0129902
## 
## $`Diagnostic:Age.group`
##                             diff          lwr          upr     p adj
## MCI:66-75-AD:66-75   0.013238444 -0.002083987  0.028560875 0.1334998
## CTL:66-75-AD:66-75   0.017529528  0.003020306  0.032038749 0.0080072
## AD:76-86-AD:66-75   -0.007167645 -0.024107230  0.009771940 0.8288658
## MCI:76-86-AD:66-75   0.003983562 -0.012956023  0.020923147 0.9844669
## CTL:76-86-AD:66-75   0.013511823 -0.003165116  0.030188763 0.1870369
## CTL:66-75-MCI:66-75  0.004291084 -0.002635652  0.011217819 0.4806767
## AD:76-86-MCI:66-75  -0.020406089 -0.031560088 -0.009252091 0.0000049
## MCI:76-86-MCI:66-75 -0.009254882 -0.020408881  0.001899116 0.1660600
## CTL:76-86-MCI:66-75  0.000273379 -0.010477550  0.011024308 0.9999997
## AD:76-86-CTL:66-75  -0.024697173 -0.034704785 -0.014689560 0.0000000
## MCI:76-86-CTL:66-75 -0.013545966 -0.023553578 -0.003538353 0.0018026
## CTL:76-86-CTL:66-75 -0.004017705 -0.013574016  0.005538607 0.8326823
## MCI:76-86-AD:76-86   0.011151207 -0.002137297  0.024439711 0.1565704
## CTL:76-86-AD:76-86   0.020679468  0.007727437  0.033631499 0.0001057
## CTL:76-86-MCI:76-86  0.009528261 -0.003423770  0.022480292 0.2837503
boxplot(K ~ Diagnostic*Age.group,
data = dados_hemi_v1_agegroups,
col = "steelblue",
border = "black", 
las = 2 #make x-axis labels perpendicular
)

5.4.7.2 S

summary(aov(S ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##                       Df Sum Sq Mean Sq F value  Pr(>F)   
## Diagnostic             2 0.1454 0.07269   6.171 0.00244 **
## Age.group              1 0.0278 0.02782   2.362 0.12568   
## Diagnostic:Age.group   2 0.1197 0.05984   5.080 0.00692 **
## Residuals            236 2.7798 0.01178                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(S ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = S ~ Diagnostic * Age.group, data = dados_hemi_v1_agegroups)
## 
## $Diagnostic
##                diff         lwr          upr     p adj
## MCI-AD  -0.05354432 -0.11335321  0.006264576 0.0896562
## CTL-AD  -0.07844671 -0.13272125 -0.024172169 0.0022049
## CTL-MCI -0.02490239 -0.06340389  0.013599102 0.2808076
## 
## $Age.group
##                   diff          lwr        upr     p adj
## 76-86-66-75 0.02315851 -0.009432015 0.05574903 0.1628534
## 
## $`Diagnostic:Age.group`
##                              diff         lwr          upr     p adj
## MCI:66-75-AD:66-75  -0.1050311808 -0.22488786  0.014825495 0.1230629
## CTL:66-75-AD:66-75  -0.0981648521 -0.21166036  0.015330654 0.1326874
## AD:76-86-AD:66-75   -0.0303712353 -0.16287778  0.102135305 0.9861650
## MCI:76-86-AD:66-75  -0.0001112472 -0.13261779  0.132395293 1.0000000
## CTL:76-86-AD:66-75  -0.1082371945 -0.23868925  0.022214856 0.1660889
## CTL:66-75-MCI:66-75  0.0068663287 -0.04731668  0.061049342 0.9991552
## AD:76-86-MCI:66-75   0.0746599455 -0.01259000  0.161909886 0.1408959
## MCI:76-86-MCI:66-75  0.1049199336  0.01766999  0.192169874 0.0084559
## CTL:76-86-MCI:66-75 -0.0032060137 -0.08730302  0.080890993 0.9999978
## AD:76-86-CTL:66-75   0.0677936168 -0.01048894  0.146076178 0.1317426
## MCI:76-86-CTL:66-75  0.0980536048  0.01977104  0.176336167 0.0051684
## CTL:76-86-CTL:66-75 -0.0100723424 -0.08482469  0.064680008 0.9988630
## MCI:76-86-AD:76-86   0.0302599881 -0.07368669  0.134206670 0.9604243
## CTL:76-86-AD:76-86  -0.0778659592 -0.17918065  0.023448734 0.2378326
## CTL:76-86-MCI:76-86 -0.1081259473 -0.20944064 -0.006811254 0.0288454
boxplot(S ~ Diagnostic*Age.group,
data = dados_hemi_v1_agegroups,
col = "steelblue",
border = "black", 
las = 2 #make x-axis labels perpendicular
)

5.4.7.3 I

summary(aov(I ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##                       Df Sum Sq Mean Sq F value   Pr(>F)    
## Diagnostic             2 0.1164 0.05820  12.539 6.68e-06 ***
## Age.group              1 0.0194 0.01940   4.179    0.042 *  
## Diagnostic:Age.group   2 0.0134 0.00669   1.442    0.239    
## Residuals            236 1.0954 0.00464                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov(I ~ Diagnostic*Age.group, data = dados_hemi_v1_agegroups))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = I ~ Diagnostic * Age.group, data = dados_hemi_v1_agegroups)
## 
## $Diagnostic
##               diff          lwr        upr     p adj
## MCI-AD  0.03630915 -0.001235734 0.07385403 0.0604567
## CTL-AD  0.06616956  0.032098852 0.10024027 0.0000223
## CTL-MCI 0.02986041  0.005691192 0.05402963 0.0108786
## 
## $Age.group
##                    diff         lwr         upr     p adj
## 76-86-66-75 -0.01933867 -0.03979729 0.001119945 0.0638147
## 
## $`Diagnostic:Age.group`
##                             diff          lwr          upr     p adj
## MCI:66-75-AD:66-75   0.020861897 -0.054377832  0.096101627 0.9678734
## CTL:66-75-AD:66-75   0.056416424 -0.014830098  0.127662945 0.2084082
## AD:76-86-AD:66-75   -0.021891575 -0.105072226  0.061289075 0.9743911
## MCI:76-86-AD:66-75   0.021866109 -0.061314542  0.105046760 0.9745213
## CTL:76-86-AD:66-75   0.014816633 -0.067074317  0.096707583 0.9953589
## CTL:66-75-MCI:66-75  0.035554526  0.001541275  0.069567778 0.0346663
## AD:76-86-MCI:66-75  -0.042753473 -0.097524406  0.012017460 0.2223107
## MCI:76-86-MCI:66-75  0.001004212 -0.053766721  0.055775145 0.9999999
## CTL:76-86-MCI:66-75 -0.006045264 -0.058836951  0.046746422 0.9994840
## AD:76-86-CTL:66-75  -0.078307999 -0.127449682 -0.029166316 0.0001098
## MCI:76-86-CTL:66-75 -0.034550314 -0.083691998  0.014591369 0.3340230
## CTL:76-86-CTL:66-75 -0.041599791 -0.088525392  0.005325811 0.1149066
## MCI:76-86-AD:76-86   0.043757685 -0.021494586  0.109009956 0.3884048
## CTL:76-86-AD:76-86   0.036708208 -0.026891838  0.100308255 0.5607152
## CTL:76-86-MCI:76-86 -0.007049476 -0.070649523  0.056550570 0.9995599
boxplot(I ~ Diagnostic*Age.group,
data = dados_hemi_v1_agegroups,
col = "steelblue",
border = "black", 
las = 2 #make x-axis labels perpendicular
)

Figure 3

mean_K_I_S <-
  dados_hemi_v1 %>% group_by(Diagnostic) %>% summarise(
    mean.K = mean(Knorm, na.rm = TRUE),
    SD_K = sd(Knorm, na.rm = TRUE),
    mean.I = mean(Inorm, na.rm = TRUE),
    SD_I = sd(Inorm, na.rm = TRUE),
    mean.S = mean(Snorm, na.rm = TRUE),
    SD_S = sd(Snorm, na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
    )
fig3a <- ggplot(mean_K_I_S, aes(x = mean.K, y = mean.S, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

fig3a

ggplot(mean_K_I_S, aes(x = mean.K, y = mean.S, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1,aes(x = Knorm, y = Snorm, color = Diagnostic), alpha = 0.2) +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

fig3c <- ggplot(mean_K_I_S, aes(x = mean.K, y = mean.I, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

fig3c

ggplot(mean_K_I_S, aes(x = mean.K, y = mean.I, color = Diagnostic)) +
  geom_point() +
  geom_line(group =1, color = "gray") +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1, aes(x = Knorm, y = Inorm, color = Diagnostic), alpha = 0.2) +
  theme_pubr() +
  # theme(axis.title = element_text(size = 11),
  #   axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2)

mean_K_I_S_agegroups <-
  filter(dados_hemi_v1_agegroups) %>% group_by(Diagnostic, Age.group) %>% summarise(
    mean.T = mean(logAvgThickness, na.rm = TRUE),
    SD_T = sd(logAvgThickness, na.rm = TRUE),
    mean.K = mean(Knorm, na.rm = TRUE),
    SD_K = sd(Knorm, na.rm = TRUE),
    mean.I = mean(Inorm, na.rm = TRUE),
    SD_I = sd(Inorm, na.rm = TRUE),
    mean.S = mean(Snorm, na.rm = TRUE),
    SD_S = sd(Snorm, na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
  )
fig3b <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age.group ))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b

fig3b_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age.group))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Snorm, color = Diagnostic, shape = Age.group), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b_Alt

fig3d <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age.group ))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() +
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)")  +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom" , legend.box="vertical", legend.margin=margin())

fig3d

fig3d_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age.group))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Inorm, color = Diagnostic, shape = Age.group), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())
fig3d_Alt

fig3s <- ggarrange(fig3b, fig3d, labels = c("A", "B"), nrow=2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

#fig3s <- ggarrange(fig3a, fig3b,fig3c, fig3d, labels = c("A", "B","C","D"), nrow=2, ncol=2, font.label = list(size = 11))

# ("fig3s.pdf",fig3s, width = 9, height = 17.1, units = "cm", device = "pdf")
fig3s_Alt <- ggarrange(fig3b_Alt, fig3d_Alt, labels = c("A", "B"),ncol = 2, nrow=1, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s_Alt
<<<<<<< HEAD

#fig3s <- ggarrange(fig3a, fig3b,fig3c, fig3d, labels = c("A", "B","C","D"), nrow=2, ncol=2, font.label = list(size = 11))

ggsave("Figure3.png",fig3s_Alt, width = 18, height = 9, units = "cm", device = "png")
ggsave("Figure3.pdf",fig3s_Alt, width = 18, height = 9, units = "cm", device = "pdf")

=======

#fig3s <- ggarrange(fig3a, fig3b,fig3c, fig3d, labels = c("A", "B","C","D"), nrow=2, ncol=2, font.label = list(size = 11))

ggsave("Figure3.png",fig3s_Alt, width = 18, height = 9, units = "cm", device = "png")
>>>>>>> 4d9cecbc0c825eb7d0bbaf2d56d55f2bd1ec1bdf
# ggsave("fig3s.pdf",fig3s, dpi = 1200, width = 18, height = 17.1, units = "cm", device = "pdf")
fig3s
\label{fig:figure3}Morphological trajectory traced across the normalized independent components K, S,and I. We normalized the variable to the unity vectors providing comparable scale for the differences in both axes. (A, C) CTL as Control (blue, N~=~77) and the reference, MCI as Mild Cognitive Impairment (green, N~=~33) and AD for Alzheimer’s Disease (red, N~=~17). (B, D) Groups were divide in two subgroups, subjects with age between 65 and 75 years (circle, CTL N~=~67, MCI N~=~24, AD N~=~4) old and subjects with ages between 76 and 85 years old (triangle, CTL N~=~10, MCI N~=~9, AD N~=~9).

Morphological trajectory traced across the normalized independent components K, S,and I. We normalized the variable to the unity vectors providing comparable scale for the differences in both axes. (A, C) CTL as Control (blue, N=77) and the reference, MCI as Mild Cognitive Impairment (green, N=33) and AD for Alzheimer’s Disease (red, N=17). (B, D) Groups were divide in two subgroups, subjects with age between 65 and 75 years (circle, CTL N=67, MCI N=24, AD N=4) old and subjects with ages between 76 and 85 years old (triangle, CTL N=10, MCI N=9, AD N=9).

5.4.8 FIGURE 3 with age intervals

Diagnostic Age_interval10 N age age_range ESC
AD [60,70) 1 63 ± 0 63 ; 63 16 ± 0
AD [70,80) 8 76 ± 4.3 70 ; 80 12 ± 2.8
AD [80,90) 4 83 ± 2.1 80 ; 86 13 ± 3.2
MCI [60,70) 11 68 ± 2.4 62 ; 70 14 ± 2.6
MCI [70,80) 17 74 ± 2.6 70 ; 80 13 ± 2.4
MCI [80,90) 3 81 ± 0.87 80 ; 82 13 ± 2.1
CTL [40,50) 4 47 ± 2.5 43 ; 48 16 ± 2.6
CTL [50,60) 12 55 ± 3.5 50 ; 60 15 ± 2.3
CTL [60,70) 34 66 ± 2.9 60 ; 70 16 ± 1.6
CTL [70,80) 26 74 ± 2.5 70 ; 78 14 ± 2.4
CTL [80,90) 1 80 ± 0 80 ; 80 12 ± 0
mean_K_I_S_agegroups <-
  dados_hemi_v1_agegroups %>% group_by(Diagnostic, Age_interval10) %>% summarise(
    # mean.T = mean(logAvgThickness, na.rm = TRUE),
    # SD_T = sd(logAvgThickness, na.rm = TRUE),
    mean.K = mean(Knorm, na.rm = TRUE),
    SD_K = sd(Knorm, na.rm = TRUE),
    mean.I = mean(Inorm, na.rm = TRUE),
    SD_I = sd(Inorm, na.rm = TRUE),
    mean.S = mean(Snorm, na.rm = TRUE),
    SD_S = sd(Snorm, na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
  )

write.csv(mean_K_I_S_agegroups, "datafig3.csv")
fig3b <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b

fig3b_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Snorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b_Alt

fig3d <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() +
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)")  +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom" , legend.box="vertical", legend.margin=margin())

fig3d

fig3d_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Inorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())
fig3d_Alt

fig3s <- ggarrange(fig3b, fig3d, labels = c("A", "B"), nrow=2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s

fig3s_Alt_allgroups <- ggarrange(fig3b_Alt, fig3d_Alt, labels = c("A", "B"),ncol = 2, nrow=1, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s_Alt_allgroups

ggsave("fig3s_Alt_allgroups.png",fig3s_Alt_allgroups, width = 18, height = 9, units = "cm", device = "png")

5.4.9 FIGURE 3 with age intervals - age corrected

mean_K_I_S_agegroups <-
  filter(dados_hemi_v1_agegroups) %>% group_by(Diagnostic, Age_interval10) %>% summarise(
    mean.T = mean(logAvgThickness, na.rm = TRUE),
    SD_T = sd(logAvgThickness, na.rm = TRUE),
    mean.K = mean(K_age_decay/ sqrt(1 + (1 / 4) ^ 2 + (5 / 4) ^ 2), na.rm = TRUE),
    SD_K = sd(K_age_decay/ sqrt(1 + (1 / 4) ^ 2 + (5 / 4) ^ 2), na.rm = TRUE),
    mean.I = mean(I_age_decay/ sqrt(1 ^ 2 + 1 ^ 2 + 1 ^ 1), na.rm = TRUE),
    SD_I = sd(I_age_decay/ sqrt(1 ^ 2 + 1 ^ 2 + 1 ^ 1), na.rm = TRUE),
    mean.S = mean(S_age_decay/ sqrt((3 / 2) ^ 2 + (3 / 4) ^ 2 + (9 / 4) ^ 2), na.rm = TRUE),
    SD_S = sd(S_age_decay/ sqrt((3 / 2) ^ 2 + (3 / 4) ^ 2 + (9 / 4) ^ 2), na.rm = TRUE),
    N_SUBJ = n_distinct(SUBJ)
  )
fig3b <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b

fig3b_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.S, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
  geom_errorbar(aes(ymin = mean.S - SD_S, ymax = mean.S + SD_S))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Snorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "S (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())

fig3b_Alt

fig3d <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() +
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)")  +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom" , legend.box="vertical", legend.margin=margin())

fig3d

fig3d_Alt <- ggplot(mean_K_I_S_agegroups, aes(x = mean.K, y = mean.I, color = Diagnostic, shape = Age_interval10))+
    geom_point() +
    geom_line(aes(group = Diagnostic)) +
    geom_errorbar(aes(ymin = mean.I - SD_I, ymax = mean.I + SD_I))  +
  geom_errorbarh(aes(xmin = mean.K - SD_K, xmax = mean.K + SD_K))  +
  geom_point(data = dados_hemi_v1_agegroups, aes(x = Knorm, y = Inorm, color = Diagnostic, shape = Age_interval10), alpha = 0.2) +
    #geom_text(aes(label=Age.group), nudge_y = 0.1, size =3)+
    theme_pubr() + 
  # guides(color = "none") + 
    labs(shape = "Age", x = "K (normalized)", y = "I (normalized)") +
    # theme(axis.title = element_text(size = 11),
    #       axis.text = element_text(size = 10), text = element_text(size = 10)) +
  scale_fill_manual(values=cbbPalette2) +
  scale_colour_manual(values=cbbPalette2) +
  theme(legend.position="bottom", legend.box="vertical", legend.margin=margin())
fig3d_Alt

fig3s <- ggarrange(fig3b, fig3d, labels = c("A", "B"), nrow=2, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s

fig3s_Alt <- ggarrange(fig3b_Alt, fig3d_Alt, labels = c("A", "B"),ncol = 2, nrow=1, font.label = list(size = 11), common.legend = TRUE, legend = "bottom")

fig3s_Alt

5.5 Behavioral and CSF data correlation

#hemisphere
dados_hemi_v1_CD <- dados_hemi_v1 %>%
  pivot_longer(
    c(
      COGNITIVE_INDEX,
      `A7/A5`,
      `TMT B-A`,
      `DIGIT SPAN BACK`,
      `AB1-40`,
      `AB1-42`,
      TAU,
      AB1_ratio,
      TAU_AB1_42_ratio,
      TAU_AB1_ratio,
      Lipoxina
    ),
    names_to = "clinical_test",
    values_to = "clinical_test_value"
  ) %>%
  pivot_longer(
    c(K, K_age_decay, logAvgThickness, logAvgThickness_age_decay),
    names_to = "morphological_parameter",
    values_to = "morphological_parameter_value")

dados_hemi_v1_CD_behaviour <-
  unique(
    filter(
      dados_hemi_v1_CD,
      clinical_test == "A7/A5" |
        clinical_test == "COGNITIVE_INDEX" |
        clinical_test == "TMT B-A" | clinical_test == "DIGIT SPAN BACK"
    )
  )

dados_hemi_v1_CD_biochq <-
  unique(
    filter(
      dados_hemi_v1_CD,
      clinical_test == "AB1-40" |
        clinical_test == "AB1-42" |
        clinical_test == "TAU" |
        clinical_test == "AB1_ratio" |
        clinical_test == "TAU_AB1_42_ratio" |
        clinical_test == "TAU_AB1_ratio" | clinical_test == "Lipoxina"
    )
  )
#frontal lobe
dados_lobos_v1_F_CD_behaviour <- filter(dados_lobos_v1, ROI == "F") %>%
  pivot_longer(
    c(
      `TMT B-A`,
      `DIGIT SPAN BACK`
    ),
    names_to = "clinical_test",
    values_to = "clinical_test_value"
  ) %>%
  pivot_longer(
    c(
      K_corrected,
      K_age_decay,
      logAvgThickness,
      logAvgThickness_age_decay
    ),
    names_to = "morphological_parameter",
    values_to = "morphological_parameter_value"
  )
#temporal lobe
dados_lobos_v1_T_CD_behaviour <- filter(dados_lobos_v1, ROI == "T") %>%
  pivot_longer(
    c(
      `A7/A5`,
    ),
    names_to = "clinical_test",
    values_to = "clinical_test_value"
  ) %>%
  pivot_longer(
    c(
      K_corrected,
      K_age_decay,
      logAvgThickness,
      logAvgThickness_age_decay
    ),
    names_to = "morphological_parameter",
    values_to = "morphological_parameter_value"
  )

5.5.1 Summary

dados_hemi_v1 %>%
group_by(Diagnostic) %>%
summarise(
N = n_distinct(SUBJ),
Mean_COGNITIVE_INDEX = mean(COGNITIVE_INDEX,  na.rm = TRUE),
STD_COGNITIVE_INDEX = sd(COGNITIVE_INDEX,  na.rm = TRUE),
Mean_A7_A5 = mean(`A7/A5`,  na.rm = TRUE),
STD_A7_A5 = sd(`A7/A5`,  na.rm = TRUE),
Mean_TMT_B_A = mean(`TMT B-A`,  na.rm = TRUE),
STD_TMT_B_A = sd(`TMT B-A`,  na.rm = TRUE),
Mean_DIGIT_SPAN_BACK = mean(`DIGIT SPAN BACK`,  na.rm = TRUE),
STD_DIGIT_SPAN_BACK = sd(`DIGIT SPAN BACK`,  na.rm = TRUE),
Mean_Lipoxina = mean(Lipoxina ,  na.rm = TRUE),
STD_Lipoxina = sd(Lipoxina ,  na.rm = TRUE),
Mean_AB1_40 = mean(`AB1-40`,  na.rm = TRUE),
STD_AB1_40 = sd(`AB1-40`,  na.rm = TRUE),
Mean_AB1_42 = mean(`AB1-42`,  na.rm = TRUE),
STD_AB1_42 = sd(`AB1-42`,  na.rm = TRUE),
Mean_TAU = mean(TAU,  na.rm = TRUE),
STD_TAU = sd(TAU,  na.rm = TRUE)) %>%
  kable(digits = 2) %>%
  kable_styling() %>%
  column_spec(1, width = "10cm")
Diagnostic N Mean_COGNITIVE_INDEX STD_COGNITIVE_INDEX Mean_A7_A5 STD_A7_A5 Mean_TMT_B_A STD_TMT_B_A Mean_DIGIT_SPAN_BACK STD_DIGIT_SPAN_BACK Mean_Lipoxina STD_Lipoxina Mean_AB1_40 STD_AB1_40 Mean_AB1_42 STD_AB1_42 Mean_TAU STD_TAU
AD 13 -3.35 1.48 0.24 0.31 226.69 131.29 3.77 1.39 79.10 73.64 5664.22 1665.88 279.71 60.00 632.00 278.83
MCI 31 -1.50 1.29 0.53 0.31 129.71 108.07 4.58 1.57 116.13 51.06 4989.81 2552.97 452.68 318.02 470.21 203.69
CTL 77 0.21 0.64 0.82 0.18 58.53 48.00 5.84 1.74 127.15 61.52 4192.04 1915.04 533.92 242.82 354.87 194.95
dados_hemi_v1_CD %>%
group_by(clinical_test, Diagnostic) %>%
summarise(
N = n_distinct(SUBJ),
Mean = mean(clinical_test_value,  na.rm = TRUE),
STD = sd(clinical_test_value,  na.rm = TRUE)) %>%
  kable(digits = 2) %>%
  kable_styling()
clinical_test Diagnostic N Mean STD
A7/A5 AD 13 0.24 0.31
A7/A5 MCI 31 0.53 0.31
A7/A5 CTL 77 0.82 0.18
AB1-40 AD 13 5664.22 1611.83
AB1-40 MCI 31 4989.81 2508.57
AB1-40 CTL 77 4192.04 1902.56
AB1-42 AD 13 279.71 58.05
AB1-42 MCI 31 452.68 312.49
AB1-42 CTL 77 533.92 241.24
AB1_ratio AD 13 0.05 0.01
AB1_ratio MCI 31 0.13 0.13
AB1_ratio CTL 77 0.16 0.12
COGNITIVE_INDEX AD 13 -3.35 1.46
COGNITIVE_INDEX MCI 31 -1.50 1.29
COGNITIVE_INDEX CTL 77 0.21 0.64
DIGIT SPAN BACK AD 13 3.77 1.37
DIGIT SPAN BACK MCI 31 4.58 1.56
DIGIT SPAN BACK CTL 77 5.84 1.74
Lipoxina AD 13 79.10 71.25
Lipoxina MCI 31 116.13 50.17
Lipoxina CTL 77 127.15 61.11
TAU AD 13 632.00 269.78
TAU MCI 31 470.21 200.15
TAU CTL 77 354.87 193.68
TAU_AB1_42_ratio AD 13 2.20 0.55
TAU_AB1_42_ratio MCI 31 1.61 1.53
TAU_AB1_42_ratio CTL 77 0.79 0.60
TAU_AB1_ratio AD 13 13027.12 6874.25
TAU_AB1_ratio MCI 31 7922.65 7198.30
TAU_AB1_ratio CTL 77 3429.86 3575.63
TMT B-A AD 13 226.69 129.37
TMT B-A MCI 31 129.71 107.41
TMT B-A CTL 77 58.53 47.88

5.5.2 Hemisphere

Corr2 <- dados_hemi_v1_CD_biochq %>%
  group_by(morphological_parameter, clinical_test) %>%
  summarise(
    t = signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$statistic,
      2
    ),
    df =  signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$parameter,
      2
    ),
    Correlation = signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$estimate,
      2
    ),
    pvalue = signif(
      cor.test(
        morphological_parameter_value,
        clinical_test_value,
        use = "complete",
        method = "pearson"
      )$p.value,
      4
    )
    ,
    eff.size = signif(
      res(
        Correlation,
        var.r = NULL,
        (df + 2) / 2,
        level = 95,
        dig = 2,
        verbose = FALSE
      )$d,
      2
    )
  ) %>%
  mutate(
    Diagnostic = "All",
    ROI = "Hemisphere",
    kind = "behaviour",
    Age_correction = ifelse(
      str_detect(morphological_parameter, "_age_decay", negate = FALSE),
      "yes",
      "no"
    )
  )

5.5.3 Frontal

5.5.4 Temporal

Corr_all <- full_join(Corr1, Corr2) %>%
  full_join(Corr3) %>%
  full_join(Corr4)

Corr_all$morphological_parameter[Corr_all$morphological_parameter == "K_corrected"] <- "K"
Corr_all$morphological_parameter[Corr_all$morphological_parameter == "K_age_decay"] <- "K"
Corr_all$morphological_parameter[Corr_all$morphological_parameter == "logAvgThickness_age_decay"] <- "logAvgThickness"

Corr_all <- Corr_all %>%
  group_by(morphological_parameter, clinical_test) %>%
  mutate(pval.adj = p.adjust(pvalue, method = 'bonferroni'))

Table 2 ## Raw

Corr_all %>%
  filter(Age_correction == "no") %>%
  # dplyr::select(-c(pvalue)) %>%
  kable(digits = 3) %>%
  kable_styling()
morphological_parameter clinical_test t df Correlation pvalue eff.size Diagnostic ROI kind Age_correction pval.adj
K A7/A5 5.90 240 0.360 0.000 0.77 All Hemisphere behaviour no 0.000
K COGNITIVE_INDEX 6.90 240 0.410 0.000 0.90 All Hemisphere behaviour no 0.000
K DIGIT SPAN BACK 4.00 240 0.250 0.000 0.52 All Hemisphere behaviour no 0.000
K TMT B-A -4.90 240 -0.300 0.000 -0.63 All Hemisphere behaviour no 0.000
logAvgThickness A7/A5 6.60 240 0.390 0.000 0.85 All Hemisphere behaviour no 0.000
logAvgThickness COGNITIVE_INDEX 6.80 240 0.400 0.000 0.87 All Hemisphere behaviour no 0.000
logAvgThickness DIGIT SPAN BACK 3.20 240 0.200 0.001 0.41 All Hemisphere behaviour no 0.005
logAvgThickness TMT B-A -3.50 240 -0.220 0.001 -0.45 All Hemisphere behaviour no 0.002
K AB1-40 -0.70 90 -0.073 0.487 -0.15 All Hemisphere behaviour no 0.975
K AB1-42 2.60 90 0.260 0.012 0.54 All Hemisphere behaviour no 0.024
K AB1_ratio 1.70 90 0.180 0.089 0.37 All Hemisphere behaviour no 0.177
K Lipoxina 1.10 88 0.110 0.293 0.22 All Hemisphere behaviour no 0.586
K TAU -2.60 90 -0.260 0.011 -0.54 All Hemisphere behaviour no 0.022
K TAU_AB1_42_ratio -3.20 90 -0.320 0.002 -0.68 All Hemisphere behaviour no 0.004
K TAU_AB1_ratio -2.80 90 -0.280 0.006 -0.58 All Hemisphere behaviour no 0.012
logAvgThickness AB1-40 -2.20 90 -0.220 0.034 -0.45 All Hemisphere behaviour no 0.068
logAvgThickness AB1-42 0.82 90 0.086 0.416 0.17 All Hemisphere behaviour no 0.833
logAvgThickness AB1_ratio 1.90 90 0.200 0.058 0.41 All Hemisphere behaviour no 0.115
logAvgThickness Lipoxina -0.49 88 -0.052 0.626 -0.10 All Hemisphere behaviour no 1.000
logAvgThickness TAU -4.30 90 -0.410 0.000 -0.90 All Hemisphere behaviour no 0.000
logAvgThickness TAU_AB1_42_ratio -3.40 90 -0.340 0.001 -0.72 All Hemisphere behaviour no 0.002
logAvgThickness TAU_AB1_ratio -4.00 90 -0.390 0.000 -0.85 All Hemisphere behaviour no 0.000
K DIGIT SPAN BACK 3.30 240 0.210 0.001 0.43 All Frontal lobe behaviour no 0.005
K TMT B-A -3.20 240 -0.210 0.001 -0.43 All Frontal lobe behaviour no 0.006
logAvgThickness DIGIT SPAN BACK 2.50 240 0.160 0.014 0.32 All Frontal lobe behaviour no 0.054
logAvgThickness TMT B-A -3.30 240 -0.210 0.001 -0.43 All Frontal lobe behaviour no 0.005
K A7/A5 4.90 240 0.310 0.000 0.65 All Temporal lobe behaviour no 0.000
logAvgThickness A7/A5 7.50 240 0.440 0.000 0.98 All Temporal lobe behaviour no 0.000

5.6 Age corrected

Corr_all %>%
  filter(Age_correction == "yes") %>%
  # dplyr::select(-c(pvalue)) %>%
  kable(digits = 3) %>%
  kable_styling()
morphological_parameter clinical_test t df Correlation pvalue eff.size Diagnostic ROI kind Age_correction pval.adj
K A7/A5 4.400 240 0.270 0.000 0.56 All Hemisphere behaviour yes 0.000
K COGNITIVE_INDEX 5.100 240 0.310 0.000 0.65 All Hemisphere behaviour yes 0.000
K DIGIT SPAN BACK 3.000 240 0.190 0.003 0.39 All Hemisphere behaviour yes 0.012
K TMT B-A -3.200 240 -0.200 0.002 -0.41 All Hemisphere behaviour yes 0.006
logAvgThickness A7/A5 4.200 240 0.260 0.000 0.54 All Hemisphere behaviour yes 0.000
logAvgThickness COGNITIVE_INDEX 4.200 240 0.260 0.000 0.54 All Hemisphere behaviour yes 0.000
logAvgThickness DIGIT SPAN BACK 1.800 240 0.110 0.079 0.22 All Hemisphere behaviour yes 0.318
logAvgThickness TMT B-A -1.100 240 -0.069 0.282 -0.14 All Hemisphere behaviour yes 1.000
K AB1-40 -0.180 90 -0.018 0.861 -0.04 All Hemisphere behaviour yes 1.000
K AB1-42 2.500 90 0.260 0.013 0.54 All Hemisphere behaviour yes 0.026
K AB1_ratio 1.600 90 0.160 0.124 0.32 All Hemisphere behaviour yes 0.248
K Lipoxina 1.300 88 0.130 0.212 0.26 All Hemisphere behaviour yes 0.424
K TAU -1.700 90 -0.180 0.091 -0.37 All Hemisphere behaviour yes 0.181
K TAU_AB1_42_ratio -2.400 90 -0.240 0.020 -0.49 All Hemisphere behaviour yes 0.040
K TAU_AB1_ratio -2.000 90 -0.200 0.051 -0.41 All Hemisphere behaviour yes 0.101
logAvgThickness AB1-40 -1.500 90 -0.160 0.133 -0.32 All Hemisphere behaviour yes 0.265
logAvgThickness AB1-42 0.007 90 0.001 0.994 0.00 All Hemisphere behaviour yes 1.000
logAvgThickness AB1_ratio 1.300 90 0.140 0.190 0.28 All Hemisphere behaviour yes 0.381
logAvgThickness Lipoxina -0.430 88 -0.046 0.670 -0.09 All Hemisphere behaviour yes 1.000
logAvgThickness TAU -2.800 90 -0.280 0.007 -0.58 All Hemisphere behaviour yes 0.014
logAvgThickness TAU_AB1_42_ratio -1.600 90 -0.170 0.114 -0.35 All Hemisphere behaviour yes 0.228
logAvgThickness TAU_AB1_ratio -2.300 90 -0.230 0.025 -0.47 All Hemisphere behaviour yes 0.050
K DIGIT SPAN BACK 2.300 240 0.150 0.023 0.30 All Frontal lobe behaviour yes 0.090
K TMT B-A -2.200 240 -0.140 0.031 -0.28 All Frontal lobe behaviour yes 0.122
logAvgThickness DIGIT SPAN BACK 1.100 240 0.072 0.270 0.14 All Frontal lobe behaviour yes 1.000
logAvgThickness TMT B-A -1.100 240 -0.071 0.273 -0.14 All Frontal lobe behaviour yes 1.000
K A7/A5 3.200 240 0.210 0.001 0.43 All Temporal lobe behaviour yes 0.006
logAvgThickness A7/A5 5.700 240 0.350 0.000 0.75 All Temporal lobe behaviour yes 0.000
>>>>>>> 7b58f8fcf301404c944e1c9ad97b807da35707e0